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
286 stars 57 forks source link

Add GeoJSON Mask Option #34

Closed DanielJDufour closed 1 year ago

DanielJDufour commented 4 years ago
new GeoRasterLayer({
    georaster,
    bounds: geojson
})

This would mean only display within the bounds.

DanielJDufour commented 3 years ago

Might be more intuitive to say:

new GeoRasterLayer({
    georaster,
    mask: geojson
})
DanielJDufour commented 2 years ago

@m-mohr

m-mohr commented 2 years ago

How much effort would this be?

prakashmani2495 commented 2 years ago

Hi, You did a excellent work which saved me a lot to work on georaster files. Can you please help, how to remove the excess layer (outside the polygon), I want the clip/mask the georaster layer with polygon on leaflet and here I'm using 4326 projection. Here I'm attaching the screen shot for reference Screenshot

.

DanielJDufour commented 2 years ago

Hi, @prakashmani2495. Thanks for helping validate this important use case. You can't clip/mask with GeoRasterLayer yet, but it's a high priority to me to get this done. I've been working on some of the dependencies for this task, which you can view here: https://observablehq.com/@danieljdufour/clip-and-reproject-a-geotiff-with-geowarp.

Unfortunately, it'll probably take a few days of concerted effort to get this done. I should have time in a couple months when my schedule lightens a little.

In the interim, you could try cropping your GeoTIFF before visualization using gdalwarp's cutline functionality.

Let me know if you have any more questions. Happy to answer and sorry for the delay. I too want this feature very much! :-)

prakashmani2495 commented 2 years ago

Hi Daniel,

Thank you for the quick response. Will try using gdalwarp's cutline functionality. Please make this a priority item, since I wanted this feature urgently.

DanielJDufour commented 1 year ago

This was completed. You can find the documentation here: https://github.com/GeoTIFF/georaster-layer-for-leaflet/blob/master/ADVANCED.md#masking