streamlit-folium integrates two great open-source projects in the Python ecosystem: Streamlit and Folium!
pip install streamlit-folium
or
conda install -c conda-forge streamlit-folium
Currently, there are two functions defined:
-
st_folium()
: a bi-directional Component, taking a Folium/Branca object and plotting to the Streamlit app. Upon mount/interaction with the Streamlit app,st_folium()
returns a Dict with selected information including the bounding box and items clicked on -
folium_static()
: takes afolium.Map
,folium.Figure
, orbranca.element.Figure
object and displays it in a Streamlit app.Note:
folium_static()
is based on the_repr_html()
representation created in Folium. This function should be a strict subset the of functionality of the newerst_folium()
function. It is recommended that users switch tost_folium()
as soon as possible, asfolium_static()
will likely be deprecated.If there is a reason why
folium_static()
needs to remain, please leave a GitHub issue describing your use case.