How can I add Folium map to the form?

Hi @reda.gossony and welcome to the forum,

Here’s a clone link that demonstrates how you might achieve this.
https://anvil.works/build#clone:L7Q6H3KMW4EKDUSO=4T2ZU2OSTOV3J4SWW5T6GW67

You won’t be able to run it without the paid version - but you should be able to move the server function to your uplink code.

The approach was taken from the docs under the section on using folium with flask:
https://python-visualization.github.io/folium/flask.html

The implementation in the docs was awfully slow to load, because the html returned tried to inject bootstrap, jquery and fontawesome into the anvil app.
But anvil already ships with those libraries so I did some hacking to remove those injected libraries.

You’ll see in the ServerModule how I did that.

4 Likes