I have what I believe is a basic use case. I have one (for the time being) object that is moving (could be a car … mine is flying).
I would like to plot its position on a map (I am currently using
streamlit-folium but I could use whatever other component)
I have a loop modifying the position of the marker (object) … but it does not move. If I move
st_data = st_folium(m, width=800, height=500) inside the loop it’s like plotting different map for each iteration (with the marker moving) but that is very slow (and I dont want multiple map)
I must be missing something
Thanks for your help (the code is here GitHub - galleon/flight-planning)
OR, you just happened to post this during the Snowflake Summit, and employees were less available to answer questions
I’m not sure this is a great use case for Folium, as you necessarily are going to have to re-draw the map (if I’m understanding correctly). Folium only takes in a static dataset, not a websocket or similar, so there’s no way to tell the map that new data arrived but not to re-draw the scene.
Hope you had a nice time with your colleagues
There is may be a go in between we can imagine to have some layers with static data (no nee to redraw them) and some with only the moving object which need to be redrawn.
Or may be the best solution is to wait for ipywidgets to be available in Streamlit and use ipyleaflet that should enable bi directional communication.
PS: While waiting what about redrawing everything at each iteration. Can it be a temporary solution ?
I’m sure that’s possible with leaflet directly, but not sure that Folium supports this either.
Yes, I would start here. To animate it, you could index into a list, always keeping the
0 element, then incrementally moving the counter up.