Search code examples
pythonflaskweb-development-serverfoliumdata-virtualization

How to create a static skeleton of a map using folium with over layers(markers) changing every hour which is hosted over a website using flask?


I am sorry if the question is confusing or doesn't make sense, this is my first project and I'll try to explain it to the best of my capabilities.

At first, I thought I would just be hosting a single map that I created using folium and inherited the template of the map into the website which is created with flask, therefore I didn't do any hardcoding in the main app.py file, however, it seemed really basic. So now using machine learning algorithms, I want to display different things over the map which makes some predictions for every hour of the day.

THE PROBLEM: It will take longer than expected to generate a new map every hour of the day (plus storing a new map so many times will be expensive in terms of storage).

MY SOLUTION: Have a skeleton map because the area that I will be making predictions on is localized, so have that area as the basic map and change the upper layers that will have the predictions displayed (basically heat map) every hour.

Is this a correct approach? Please recommend a right path to implement this. I am open to trying new things as long as it gets the job done. Would really appreciate any help regarding this. Thanks in advance


Solution

  • Folium does not support WebSockets if anything add new javascript to fetch data dynamically, but the best way would be to fetch data instead of rendering html everytime, it would help with the speed issue as well. Also, look into leaflets that would help too.