Skip to content

MarkerCluster not working properly in Streamlit 1.34 onwards #222

@benjamin-awd

Description

@benjamin-awd

It seems that Streamlit version 1.34 introduced some kind of regression for Folium -- specifically it disables the Spiderfy functionality in MarkerCluster (and I think any related interactivity)

Expected
(on click)
image

Current
folium_regression

To reproduce

pip install streamlit==1.34
import streamlit as st

st.set_page_config(
    page_title="streamlit-folium documentation",
    page_icon=":world_map:️",
    layout="wide",
)

left, right = st.columns(2)

with left:
    with st.echo():
        import folium
        import streamlit as st

        from streamlit_folium import st_folium
        from folium.plugins import MarkerCluster

        # center on Liberty Bell, add marker
        m = folium.Map(location=[39.949610, -75.150282], zoom_start=16)
        
        marker_cluster = MarkerCluster().add_to(m)
        folium.Marker(
            [39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell"
        ).add_to(marker_cluster)
        folium.Marker(
            [39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell"
        ).add_to(marker_cluster)
        folium.Marker(
            [39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell"
        ).add_to(marker_cluster)

        # call to render Folium map in Streamlit
        st_data = st_folium(m, width=725)

with right:
    st_data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions