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
296 stars 58 forks source link

Get all visible pixels as array or data url #140

Open divyaaaaaa opened 9 months ago

divyaaaaaa commented 9 months ago

Is your feature request related to a problem? Please describe. I want to be able to get the screen grab of visible pixels in the layer and pass it for let's say Machine Learning Inference. It would be nice if there a was direct toDataUrl giving all the visible pixels.

Currently, it looks very difficult to obtain, slice and stitch values from getActiveTiles.

Describe the solution you'd like A toDataUrl or getPixelArray kind of function to give me the values. I'm relatively new to JS, but seems if pixels are visible on Canvas, they might as well be extracted.

Describe alternatives you've considered Solution I am trying currently is to use getActiveTiles, slice to canvas extent and concatenate all the tiles. An alternative is to use getValues, but that too would need some stitching. Another alternative, not very relevant here, is I'm planning to use rasterio based python service in the backend, which would bring unacceptable latency.

Additional context