Skip to content

19 map to html

image image image

Saving maps as a html file

Uncomment the following line to install leafmap if needed.

1
# !pip install leafmap
1
import leafmap.foliumap as leafmap

Create an interactive map.

1
2
3
m = leafmap.Map()
m.add_basemap("HYBRID")
m

Specify the output HTML file name to save the map as a web page.

1
m.to_html("mymap.html")

If the output HTML file name is not provided, the function will return a string containing contain the source code of the HTML file.

1
html = m.to_html()
1
# print(html)