Skip to content

Update/refresh an already rendered map? #906

Open

Description

@deeplook

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?

Activity

  1. changed the title [-]Update/refresh an already drawn map?[/-] [+]Update/refresh an already rendered map?[/+] on Jul 11, 2018
  2. Conengmo commented on Jul 11, 2018

    @Conengmo
    Member

    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.

  3. added
    question
    on Jul 11, 2018
  4. deeplook commented on Jul 12, 2018

    @deeplook
    ContributorAuthor

    @Conengmo That's cool! I've played a bit with the TimestampedGeoJson example. If I import it from folium.plugins it works fine and shows the playing widgets on the map. If I copy the code locally and import TimestampedGeoJson from it I don't get these widgets, though. Any ideas, why? I wanted to do this as a first step in trying to come up with a StreamingGeoJson example in the spirit of this one for node.js.

  5. Conengmo commented on Jul 17, 2018

    @Conengmo
    Member

    I'm not sure what you mean. Maybe you can share a link to a branch, gist of notebook?

  6. deeplook commented on Jul 26, 2018

    @deeplook
    ContributorAuthor

    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

  7. Conengmo commented on Jul 28, 2018

    @Conengmo
    Member

    Good call. I'll close the issue then.

  8. danwild commented on May 18, 2021

    @danwild

    @Conengmo

    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

  9. Conengmo commented on May 19, 2021

    @Conengmo
    Member

    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.

  10. danwild commented on May 19, 2021

    @danwild

    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.

  11. added
    enhancement
    and removed
    question
    on May 19, 2021
  12. deeplook commented on May 19, 2021

    @deeplook
    ContributorAuthor

    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.

  13. pstatonwx commented on Apr 5, 2022

    @pstatonwx

    Any update/progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions