Hi,
I have been trying to style hover tooltips on folium maps and have been running into trouble with passing along styling to my streamlit app via streamlit-folium.
Here is my code below:
m2 = folium.Map(location=[lat, lon], zoom_start = 6, min_zoom = 5, max_zoom = 7)
tooltip = folium.GeoJsonTooltip(
fields=[“X”, “Y”, “Z”],
aliases=["X: ", “Y: “, “Z: “],
localize=True,
sticky=False,
labels=True,
style=”””
background-color: #F0EFEF;
border: 2px solid black;
border-radius: 3px;
box-shadow: 3px;
text-align: right;
“””,
max_width=800
m2.add_child(folium.GeoJson(df2.head(1),
style_function=lambda x:{
‘fillColor’: ‘#DF1111’,
‘fillOpacity’: .4,
‘color’: ‘black’,
‘Opacity’: .9,
‘weight’: .6
},
tooltip=tooltip)
)
st_folium(m2, center=st.session_state[“center”], zoom=6, height = hgt, width = wdt, use_container_width = True, returned_objects=)
The formatting from st_folium outputs the map tooltips as the default tooltip, with no formatting changes. I’ve saved the html to my drive and the map appears with all styling included, so I’ve narrowed down the problem to the actual passing of the map to streamlit via st_folium.
Has anyone found a way to resolve this? Thank you.
R