Folium has been the subject of numerous threads and feature requests, so I decided to kickoff the beginning of Folium support within Streamlit!
Installation is as straightforward as:
pip install streamlit-folium
import streamlit as st from streamlit_folium import folium_static import folium "# streamlit-folium" with st.echo(): import streamlit as st from streamlit_folium import folium_static import folium # center on Liberty Bell m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) # add marker for Liberty Bell tooltip = "Liberty Bell" folium.Marker( [39.949610, -75.150282], popup="Liberty Bell", tooltip=tooltip ).add_to(m) # call to render Folium map in Streamlit folium_static(m)
How it works
This Component uses
components.html to take the HTML generated from a
render() method, and display it as-is within Streamlit.
Limitations and Future Development
As I’ve mentioned in other Folium threads, I hadn’t even heard of Folium until people started requesting it! So I’m barely on the scale of a new Folium user. Testing was done by going through the Folium quickstart and copy-pasting results to see if they work. They do appear to work, providing a similar experience to Jupyter Notebook rendering.
I welcome Folium enthusiasts to contribute to this package to make it what YOU want to see.