GeoTIFF / georaster-layer-for-leaflet

Display GeoTIFFs and soon other types of raster on your Leaflet Map
https://geotiff.github.io/georaster-layer-for-leaflet-example/
Apache License 2.0
284 stars 57 forks source link

Resampling bug? #86

Closed vlach1989 closed 2 years ago

vlach1989 commented 2 years ago

Hi,

I came accross the following bug. I have a COG where the pixel values are: 0 - no data, 1 - irrigation, 2 - no irrigation. PixelValuesToColorFn is used for styling, where for value 0 no color is applied, the raster is transparent in those places, value 1 is represented by blue color and value 2 is represented by grey color. As you can see in the attached image, strange "edges" are created between the regions.

resampling_github

Expected behavior In this image where the same data is visualized in QGIS you can see the correct behavior. qgis

DanielJDufour commented 2 years ago

Hi. I think this might be an issue with bilinear resampling. You can try nearest resampling like so:

new GeoRasterLayer({ georaster, resampleMethod: "nearest" })

Let me know if that fixes it for you!

vlach1989 commented 2 years ago

Hi. It works! Thanks so much for tip as well as quick response!

image