-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update/refresh an already rendered map? #906
Comments
You're right that folium cannot dynamically update data, as in you cannot send data from Python to the already rendered map. Unless someone has a good idea for how to sensibly do this, this is out of the scope of folium. You can of course update your Python data and then again render the map. But that wouldn't be fast enough for animations I suppose. Haven't tried this. Have you looked into the plugins that can do animations? There is a plugin for timestamped geojsons that might work best for you. Example for that is here, check it out. There's also an example for the timeslider choropleth plugin. And maybe have a look at the heatmap with time plugin. |
@Conengmo That's cool! I've played a bit with the |
I'm not sure what you mean. Maybe you can share a link to a branch, gist of notebook? |
I will likely use ipyleaflet instead as that provides very simple features to modify map content dynamically. See https://youtu.be/NBZBjEjN-rU?t=2h20m15s |
Good call. I'll close the issue then. |
IMO not having this feature is a pretty substantial blocker to building more complex/interactive applications with Folium (particularly with proliferation of dashboarding tools like Voilà, Dash, Streamlit, Panel, etc. that could be making use of Folium). Having to recreate an entirely new map just to change update a fraction of existing data/layers is a huge overhead (e.g. as I'm understanding it - currently if you have 10 layers and want to arbitrarily modify 1x layer, you need to recreate the map and all 10x layers). I note that PyDeck, which serves a similar role to Folium, appears to have implemented this, so perhaps some ideas there: https://pydeck.gl/deck.html#pydeck.bindings.deck.Deck.update |
Hi Dan, folium is maintained by volunteers. Having new or better functionality is entirely dependent on whether someone turns up to make the effort. If you or someone else wants to look into this you are welcome to do so. I agree with what you are saying. It’s more a question of what needs to change to make it possible, and how to do that in a clean and sane way. I don’t know the answer yet to both those questions. Someone would have to investigate. |
Yep @Conengmo I 100% understand these things don’t just happen by themselves, and a PR would have been much more helpful than a comment 😅 I guess at a minimum I’m suggesting the issue should be reopened to acknowledge that this feature would indeed be useful, and that help is invited. Bonus points if those familiar with Folium code base could provide any tips on where a new contributor might get started. |
It could be hard for Folium to provide such features. Depending on what exactly is needed I would recommend considering Ipyleaflet, too. It is way more dynamic and better suited for more complex, say analysis, contexts, while Folium seems to target better static simple use cases on websites. |
Any update/progress on this? |
This is more of a feature request, as I don't think this already works. But it would be very useful to have the possibility to render a map, say with some GeoJSON content, and re-render (refresh) the same map (in a Jupyter notebook cell, say) with some other or additional content, later. It would also allow for some kind of simple animations. Or are there any other ways to get this?
The text was updated successfully, but these errors were encountered: