Python Forum
Folium: HeatMapWithTime is not displaying data point
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Folium: HeatMapWithTime is not displaying data point
#1
I have already visualized the heatmap with LayerContol with folium but now I want to add a time index for having a time filter wihtin the Heatmap. Therefore, I started with the import of the HeatMapWithTime plugin and the integration of a time index.
Now my problem: After the integration of the time index, my visualized data points disappear, only the empty map is left. But the time slider integration works. I do not get any error messages. This is how my code looks:
import folium
import pandas as pd
from folium.plugins import HeatMapWithTime

noro = pd.read_csv('norovirus.csv')

heatNoro = [[row["lat"], row["lon"], row["amount"]] for idx, row in noro.iterrows()]

mapNoro = folium.Map(location=[50.0, 10.3], tiles="cartodbpositron", zoom_start=6)

time_index_noro = [[row["Date"]] for idx, row in noro.iterrows()]

mapNoro.add_child(HeatMapWithTime(heatNoro,
        index=time_index_noro,
        name='Norovirus',
        radius=30,
        min_opacity=0.1))

mapNoro.add_child(folium.LayerControl())
mapNoro.save('mapnoroheattest2.html')
My data frame looks like this:

lat           lon      amount    Date
48.847306     2.433284   1       2018-01-15
48.861935     2.441292   1       2018-01-15
48.839644     2.655109   1       2018-01-15
48.924351     2.386369   4       2018-01-16
48.829872     2.376677   8       2018-01-16
Another problem: Right now, the time slider handles every single row as a separate point on the time slider (so the slider has the same length as my data frame). In theory, there should be only two values to select out of 700 rows: 2018-01-15 and 2018-01-16

In the end, it should look like this in the best case: http://apps.socib.es/Leaflet.TimeDimensi...ple12.html

If someone has an idea, it would be great!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can draw a real-time marker on map using folium/leaflet Jupyter notebook C3PO 0 2,389 Dec-22-2020, 07:04 PM
Last Post: C3PO
  no image displayed with folium and pandas Declaix 1 2,080 Oct-29-2020, 05:44 PM
Last Post: snippsat
  Displaying Result from Data Frame from Function eagle 1 2,360 Apr-08-2020, 11:58 PM
Last Post: eagle
  Folium FastMarkerCluster OgnjanD 0 5,557 Jun-01-2018, 06:20 PM
Last Post: OgnjanD

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020