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

Hover Events #84

Closed rumski20 closed 2 years ago

rumski20 commented 2 years ago

Hello, I was wondering if there was a means of integrating hover events this layer. I know that it extends L.gridLayer. And I see that someone has figured out how to add these events to gridLayers https://stackoverflow.com/a/56670662/6072959

Maybe in the createTile() or drawTile() functions, some means of specifying a popup or tooltip could be exposed?

Thanks.

DanielJDufour commented 2 years ago

Hi, @rumski20 . That's a great idea! There's currently no easy way to do this integration. Perhaps we could add a bindPopup or bindTooltip function to GeoRasterLayer? Are you looking to pass information to the popup? If yes, what type of information? I'm trying to determine if you want pixel-level or layer-level information. Here's an example that also might be useful if you want pixel level info. You might be able to change the on('click', ... to an on('hover', ...

https://geotiff.github.io/georaster-layer-for-leaflet-example/examples/load-via-script-tag-with-geoblaze.html

rumski20 commented 2 years ago

I forgot to circle back around to this. Your example helped me get it working.

The keys were adding an empty tooltip to the layer at instantiation. And then running geoblaze.identify(this.georaster, [latlng.lng, latlng.lat]) in a mousemove event handler. And populating the tooltip with the results of the geoblaze.identify.

Thanks again.

AmauryVa commented 2 years ago

Hello @rumski20 Can you share me a working example ? I currently generate a geotiff with 3 bands (RGB) that represente wind speed. I would like to display a tooltip on click and display the value of wind speed. Maybe the solution is to export the wind speed in 4th bands and display it in tooltip?

Thank you very much.