I have been creating Heat Maps with a Time dimension using both test data and my own datasets using the Folium libraries in Python. I am using Python 3.5 to do this, and the results have been good.
I have been away and one returning I have noticed that these scripts no longer produce a result that is viewable.
The scripts run without error, and the outputs open with the correct basemaps, however, the heatmap and the time sliders are no longer visible.
At first I thought it was the data I was using, but I have a test script taken from Git that I have been using to test some formatting and displays, but this no longer works.
https://github.com/python-visualization/folium/blob/master/tests/plugins/test_heat_map_withtime.py
import folium
import folium.plugins as plugins
import numpy as np
import webbrowser
from datetime import datetime, timedelta
np.random.seed(3141592)
initial_data = (
np.random.normal(size=(100, 2)) * np.array([[1, 1]]) +
np.array([[48, 5]])
)
move_data = np.random.normal(size=(100, 2)) * 0.01
data = [(initial_data + move_data * i).tolist() for i in range(100)]
weight = 1 # default value
for time_entry in data:
for row in time_entry:
row.append(weight)
print (data)
time_index = [
(datetime.now() + k * timedelta(1)).strftime('%Y-%m-%d') for
k in range(len(data))
]
print (len(time_index))
m = folium.Map([48., 5.], tiles='stamentoner', zoom_start=6)
hm = plugins.HeatMapWithTime(
data,
index=time_index,
auto_play=True,
max_opacity=0.3
)
hm.add_to(m)
m.save (r'c:\temp\Time.html')
webbrowser.open(r'c:\temp\Time.html')
Has something changed with the Folium libraries / anything?
I thought maybe it was a firewall issue at work, but even going offline / using a connection outside of work produces the same result:
A Basemap, with no data to display.
Best Answer
There has been an update in December 2019 upgrade folium and it should return, mine have today on doing pip install folium --upgrade