I have a HeatMapWithTime created with the folium library. The heatmap changes over time. I want to export this map into an HTML in a dynamic format. I want to use this map for presentations without having to run the code. Please I would appreciate it if someone can show me how to export my map without losing the time step.
My map code:
map_Oslo = folium.Map(location=[Latitude, Longitude], zoom_start=5)
plugins.HeatMapWithTime(heat_data,
radius=10,
gradient={0.1: 'blue', 0.2: 'blue', 0.4: 'lime', 0.6: 'orange', 0.8: 'red', 0.99: 'purple'},
min_opacity=0.5, max_opacity=0.8, use_local_extrema=False).add_to(map_Oslo)
map_Oslo
I tried some suggestions but I get the error WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
and I can not tell if the code works. :
import os
import time
from selenium import webdriver
delay=5
fn='testmap.html'
tmpurl='file://{path}/{mapfile}'.format(path=os.getcwd(),mapfile=fn)
map_Oslo.save(fn)
browser = webdriver.Firefox()
browser.get(tmpurl)
#Give the map tiles some time to load
time.sleep(delay)
browser.save_screenshot('map.png')
browser.quit()
试试这个简单的解决方案:
map_Oslo.save("heat_map.html")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.