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

fully resolve raster pixels at high zoom levels #79

Closed jcphill closed 2 years ago

jcphill commented 2 years ago

When zoomed in such that there are fewer raster pixels than the specified resolution, draw raster pixels as rectangles with raster pixel boundaries accurate to screen resolution if possible in the raster reference system. Artifacts are visible if the raster pixels are not aligned with the axes of the map/screen. Avoids performance loss from over-sampling.

DanielJDufour commented 2 years ago

Hi, @jcphill . I did a quick read through and looks awesome! My next step will be to clone locally and do some testing.

jcphill commented 2 years ago

Thanks! Let me know if anything is broken or doesn't make sense.

DanielJDufour commented 2 years ago

@jcphill . Is there a GeoTIFF or specific tests that I should look at that help illustrate the before vs. after this PR's changes? Seeing a visual representation would help me wrap my head around all this awesome work!

jcphill commented 2 years ago

Just zoom in on any raster until you start seeing individual raster pixels then keep going. Your tests/undersampling.html shows it pretty well.

jcphill commented 2 years ago
undersampling

tests/undersampling.html zoomed in, old on left, new on right. Notice that pixels are all the same size even at high zoom.

jcphill commented 2 years ago
ndvi

tests/ndvi.html, old on left, new on right. On left pixels are blurred (by sampling in getRasters()) and aligned with pixel boundaries (plus the shifted tiles #77 bug). On right actual raster pixels are visible, although there are discontinuities at tile boundaries due local angle between map and raster coordinate systems (there are ways to improve pixel rendering to fix this).

DanielJDufour commented 2 years ago

Hi, I made a small PR / suggestion here: https://github.com/jcphill/georaster-layer-for-leaflet/pull/2

DanielJDufour commented 2 years ago

Thank you for the awesome work @jcphill !

jcphill commented 2 years ago

Thanks @DanielJDufour, this package has been a real enabler for our project and I'm happy to have been able to contribute something back.