socib / Leaflet.TimeDimension

Add time dimension capabilities on a Leaflet map.
MIT License
433 stars 138 forks source link

Adding a tooltip to a TimeDimension aware GeoJSON #185

Open keul opened 4 years ago

keul commented 4 years ago

I'm trying to add a standard on-hover tooltip to a GeoJSON layer.

Also trying to apply a basic static text seems not working.

Example here:

https://codesandbox.io/s/leaflettimedimension-with-tooltip-eyts2

If I enable the tooltip on the wrapped GeoJSON it will not work but if I try to call the bindTooltip on the the L.TimeDimension.Layer.GeoJSON wrapper object I get an error.

Is this doable in any way, maybe extending the abstract Layer or something similar?

keul commented 4 years ago

... just tested adding a plugin in the condesandbox you kindly prepared for me in #183 and it works there! 😬

https://codesandbox.io/s/leaflettimedimensionchoropleth-3nihd

I planned to switch to this approach in any case in the short term, so you can close this issue. Although I think that the "official" GeoJSON plugin should easily handle this case (best match would be to have some time-related data in the tooltip probably)

iacopoff commented 4 years ago

Hi @keul, do you think it is possible to extend the L.TimeDimension.Layer to inherit from L.geoJSON the options such as onEachFeature etc. ? or even to inherit from the leaflet-choropleth plugin?

thanks

keul commented 4 years ago

@iacopoff I'm not sure what you mean, but using the leaflet-choropleth approach worked very well for me

iacopoff commented 4 years ago

@keul, sorry I am a novice in leaflet/javascript so i may not use the right words.

Below you can see some of the options i can set when i am creating a L.choropleth layer ( https://github.com/timwis/leaflet-choropleth): image

When i am creating a L.TimeDimension.Layer.GeoJSON does this layer have such options?

I am sure the valueProperty belong only to the L.choropleth, but the onEachFeature should be a option of the class L.GeoJSON so the L.TimeDimension.Layer.GeoJSON should have it?

I can try to explain further if it is not clear what i mean.

thanks

keul commented 4 years ago

@iacopoff I don't think is will work that way. The choropleth is just a wrapper

iacopoff commented 4 years ago

Alright, I think I need to spend more time understanding Leaflet.

Thanks