Project Brief
If you ever need to make an interactive web map to show to the world, folium and streamlit are the answer. Below you will see a snapshot of what we will build in this project and also the link to the live app:
https://europe-map.streamlit.app
Step-By-Step Instructions
Download this CSV file of European countries. The file looks like this:
Make a map that shows the coordinates of each country with a marker.
When the user clicks a marker, the country name should pop up (e.g., as shown in the map screenshot for United Kingdom)
Environment Setup Instructions
Install the required libraries with:
pip install pandas streamlit folium streamlit-folium
Run the app with streamlit run main.py
Resources
In this project, we are using pandas to load the CSV file. Then, we use the folium library to create an HTML map. However, folium simply creates a static HTML file. You need a web framework if you want to serve that web map through a website. For this we use streamlit. Finally, we use the streamlit-folium library to make the connection between folium and streamlit.
See an example of how to use streamlit and folium together to display a map with a single marker:
Project Solution
👉 The solution contains both the code and the steps to deploy the app and obtain a free public URL.
Finally got around to doing this one. Had no idea streamlit existed, it's awesome!
https://europemap-app-folium-drrawley.streamlit.app/
Edit: made a more readable URL and project name.
Edit: changed the map to link to wikipedia page for said country when you click on the popup
Oh, one thing I noticed, the coordinate data for Faroe Islands is wrong, It should be -6.7735, it's in the data file as + for some reason
Gibraltar is wrong too