Fix streamlit-folium incompatibility (add layer to map with new class) by Conengmo · Pull Request #1834 · python-visualization/folium (original) (raw)
Fix the compatibility issue between Folium 0.15.0 and streamlit-folium, see randyzwitch/streamlit-folium#148.
When adding layers to the map, don't add the relevant code to the figure object. Instead, add a new class instance to the Layer instance. That way it will get rendered even if only the map and not the figure is being rendered. This is also maybe a bit nicer, since it's more in line with how the rest of Folium works.