I am trying to display dynamically polygons on a map (e.g. I click on a button outside the map and it overlays a polygon on the map, and if I click on another button then another polygon appears).
As explained in dynamic_map_vs_rerender.py, I use the feature_group_to_add parameter of st_folium to show the polygons, but any style parameter specified into a folium.GeoJson object are not taken into account when displayed on the map.
Above, the style_parcel dict will not be taken into account and the polygon will be displayed blue. If I specify some style into a GeoJsonTooltip, it will also not be taken into account when displayed on the map.
I think the style works if I add the folium.GeoJson polygon statically to the map (with .add_to(map)), as in geojson_popup.py, but won’t it break the dynamic aspect of the map ?
Is there any workaround possible to make it work ?
I am using python 3.11.6, streamlit 1.27.2, streamlit-folium 0.15, folium 0.14.
Hi @patrontheo, welcome to the forum! Thank you for also opening an issue on the repository issues – I’ll go ahead and link to that post, and respond your question there.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.