opengeos / leafmap

A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
https://leafmap.org
MIT License
3.21k stars 386 forks source link

Add streamlit support for heremap module #118

Closed giswqs closed 3 years ago

giswqs commented 3 years ago

To add stseamlit support for the heremap plotting backend, we need to save the map as an HTML file. However, it seems the exported HTML lose the map controls (e.g., zoom control, fullscreen control). @sackh Any advice?

import leafmap.heremap as leafmap
from ipywidgets.embed import embed_minimal_html

m = leafmap.Map()
m

embed_minimal_html('heremap.html', views=[m])

image

The same method works fine for ipylealfet. The exported HTML has the map controls.

image

sackh commented 3 years ago

@giswqs I will look into it.

giswqs commented 3 years ago

This feature has been implemented. See https://leafmap.org/heremap/#leafmap.heremap.Map.to_streamlit. Currently the exported map does not contain controls (e.g., zoom control, layer control), which needs to be fixed by the upstream heremap widget.

import leafmap.heremap as leafmap
m = leafmap.Map()
m.to_streamlit()