Hey,
I'm currently trying to create a Heatmap with a time dimension as shown in this example.
I managed to create a Heatmap with different Layers for each day as a workaround but it would be awesome to have a time bar rather than selecting each day manually.
I know that you already implemented the TimestampedGeoJson function but i wasn't able to use it with Heatmaps instead of just points on the map.
Thanks for your help and by the way folium is a very helpfull python package.
Regards,
Florian
@FlorianHoevelmann folium needs a lot of work to wrap of the functionalities in Leaflet.TimeDimension. I don't think what you want to do is possible yet. I will leave this issue open in case someone wants to implement this.
@ocefpaf I'd be interested in helping to add this, partly because I want it, and partly because I want to learn the library better. Is there someone on the team I could get in contact with to get an outline of what needs doing so I have a bit of direction as I dig in?
@ocefpaf I'd be interested in helping to add this, partly because I want it, and partly because I want to learn the library better.
Awesome!
Is there someone on the team I could get in contact with to get an outline of what needs doing so I have a bit of direction as I dig in?
The best guy would be @BibMartin, but he is quite busy with his day job.
I would start by reading the docs and examples from https://github.com/socib/Leaflet.TimeDimension
We usually do the inverse approach. First we set a minimum HTML example and then code the Python part that produces it.
Thanks. I've been digging around the code/docs already, but it is always good to have some goal in mind too :-)
We usually do the inverse approach. First we set a minimum HTML example and then code the Python part that produces it.
You mean directly using Leaflet right? This seems sensible, do you have any examples of 'minimum HTML' you've used in the past? (just as a guide to complexity)
@ocefpaf I'd be interested in helping to add this
Great ! Thanks @Padarn for future efforts.
I have tried to work with Leaflet.Timesdimension and must admit it's not that easy.
I'll try to investigate also on how we could do this.
A few hints:
data = [
[[40, 3], [41, 3], [42, 3], [44, 3]], # data for time 0
[[40, 4], [41, 4], [42, 4], [44, 4]], # data for time 1
[[40, 5], [41, 5], [42, 5], [44, 5]], # data for time 2
]
index = ["2016-01-01", "2016-02-01", "2016-03-01"]
folium.plugins.TDHeatmap(data, index=index).add_to(map)
Thanks for the tips @BibMartin. Hopefully I haven't bitten off more than I can chew for a first go, but I'll see where I get to.
@BibMartin great! Yes I'll go ahead and try to make the plugin - this makes my first contribution much less painful :-)
I've started on this, initial PR here:
https://github.com/python-visualization/folium/pull/567
I've included a small example (but it doesn't render in github)
https://github.com/Padarn/folium/blob/HeatMapWithTime/examples/HeatMapWithTime%20example.ipynb
Still plenty of cleaning up to add, and making the options a bit more sensible etc, but any initial feedback appreciated.
@Padarn Awesome work. I will try to review it soon. BTW you can use nbviewer for a rendered version that works: http://nbviewer.jupyter.org/github/Padarn/folium/blob/HeatMapWithTime/examples/HeatMapWithTime%20example.ipynb
This looks really promising, any updates?
Implemented in #567
I'm having trouble seeing anything at all in the current version. When I do a normal heatmap it shows up just fine, but the heatmap with time doesn't show any points at all. The links to the example scripts don't seem to be current (404). Can anyone provide a sample of something that works?
Here's what I am trying:
from folium.plugins import HeatMap, HeatMapWithTime
m = folium.Map([35., -118.5], tiles='stamentoner', zoom_start=5)
#HeatMap(data).add_to(m) # This works
HeatMapWithTime(data, index=list(dfMerged["Year"].values)).add_to(m) # This doesn't work
m.save('Heatmap.html')
m
In HeatMapWithTime, how can display the difference between the points which have different numbers,such as Point A with 1000 and Point B with 5000?
Most helpful comment
Hi @Padarn
I finally found a way to use Timedimension offline, in a way that seem to be _foliumizable_.
Here is the gist and here is the demo
Do you want to go on creating the plugin that binds this code into python ?