python-visualization / folium

Python Data. Leaflet.js Maps.

Home Page:https://python-visualization.github.io/folium/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smooth markers refresh for navigation support

Alessandro-Minerba opened this issue · comments

Hi, I'm quite new to the folium library and I'm implementing a map on a PyQt6 application for real time navigation support.
First of all great job, it looks really good for a fresh new developer.
Regarding my issue, I made some researches and I understood there's no way to have a smooth way to update markers position without reloading the entire map, which creates a bad looking flashing during the route.
There's any chance in the future to have this feature available in the library?
Thank you in advance.

You could have a look at the Realtime plugin. This plugin allows you to update the map without reloading it. For this to work however, you need to also develop an HTTP server (or something similar, like Flask, Django or FastAPI) that will calculate the current map state and return it as JSON.

from flask import Flask

app = Flask(__name__)

@app.route("/navigate")
def navigate():
    return calculate_state()

# and from some other part of your code in another thread
app.run(host='0.0.0.0', port=5000, debug=True)