> ## Content Index
> Fetch the complete content index at: https://www.daanalytics.nl/llms.txt
> Use this file to discover other available public pages before exploring further.

# Mapping Formula 1 Circuits in Streamlit with Folium
- URL: https://www.daanalytics.nl/plotting-f1-circuit-locations-into-a-map-on-streamlit-using-folium/
- Published: 2022-12-15T15:42:54.000Z
- Updated: 2026-08-28T07:37:41.000Z
- Author: Daan Bakboord
- Tags: Python & Streamlit, Snowflake, Python, Streamlit, F1, Geospatial

In my last [blogpost](https://daanalytics.nl/plotting-f1-circuit-locations-into-a-map-using-folium/?ref=daanalytics.nl) I showed how to plot F1 Circuit Locations into a map using Folium. This was a very static way to plot the F1 Circuit Locations either for the World, Europe or France. These options were hardcoded in the notebook and showed after each other.

Next step would be to make the solution more interactive, using Streamlit. The idea is to switch between the World, a possible Continent and a possible Country. Check the video below.

**Streamlit App - Plotting F1 Circuit Locations into a map on Streamlit using Folium**

To make the above possible, I have taken the [code](https://github.com/daanalytics/Snowflake/blob/master/python/F1FoliumCircuits.ipynb?ref=daanalytics.nl) from the last [blogpost](https://daanalytics.nl/plotting-f1-circuit-locations-into-a-map-using-folium/?ref=daanalytics.nl). As I presented at [BUILD.local ](https://noti.st/daanalytics/8Dkmij?ref=daanalytics.nl)last month, it's relatively straight forward to get started with Streamlit. There are a few things to take into consideration.

1. To make things work in Streamlit (compared to the previous notebook) the necessary additional Python libraries have to be installed and imported.

![To make things work in Streamlit (compared to the previous notebook) the necessary additional Python libraries have to be installed and imported.](https://www.daanalytics.nl/content/images/2022/12/Import-Streamlit-libraries-2.png)

1. Streamlit Page settings come before all the other logic

![Streamlit Page settings come before all the other logic](https://www.daanalytics.nl/content/images/2022/12/Setup-Streamlit-webpage-1024x280-2.png)

Compared to the previous [blogpost](https://daanalytics.nl/plotting-f1-circuit-locations-into-a-map-using-folium/?ref=daanalytics.nl), Streamlit should include some more interactivity. Therefore the logic has to be changed to be able to select and filter different values.

I used a s Streamlit-statement; 'st.sidebar' to put some controls in the Sidebar of the Streamlit application.

1. Adding filter(s) - Radio button to select between the World, a possible Continent and a possible Country

![Adding filter(s) - Radio button to select between the World, a possible Continent and a possible Country](https://www.daanalytics.nl/content/images/2022/12/Streamlit-Radio-Button-2.png)

1. Load data based on the selected 'Map Type'

![Load data based on the selected 'Map Type'](https://www.daanalytics.nl/content/images/2022/12/Load-Data-Radio-Button-selected-2.png)

1. Create Datasets, based on the selected 'Map Type'; One query for the 'World', selections based on this query for 'Continent' and 'Country'.

[Bekijk code op GitHub Gist](https://gist.github.com/daanalytics/a3446e9fb50492849e860edb448bc788?ref=daanalytics.nl)

1. Show a different 'Select Box' based on the selected 'Map Type'

[Bekijk code op GitHub Gist](https://gist.github.com/daanalytics/5c222cd3521cba77ac323b9326a2aa44?ref=daanalytics.nl)

1. Filter Data based on the selection per 'Map Type'

![Filter Data based on the selection per 'Map Type'](https://www.daanalytics.nl/content/images/2022/12/Filter-Data-Select-Box-2.png)

1. Create Data Set for the Folium map not be drawed based on the selection per 'Map Type'

[Bekijk code op GitHub Gist](https://gist.github.com/daanalytics/61099d3faf9e79789c2a0214e44094d9?ref=daanalytics.nl)

1. Draw the Folium Map based on the selection per 'Map Type'

[Bekijk code op GitHub Gist](https://gist.github.com/daanalytics/6eb56c93a5f93c9af8faa076f2cac66a?ref=daanalytics.nl)

**Note:** Zoom the Folium Map based on the 'Latitude / Longitude'-edges (Left Down and Top Right) of the selected circuits.

![Zoom the Folium Map based on the 'Latitude / Longitude'-edges (Left Down and Top Right) of the selected circuits.](https://www.daanalytics.nl/content/images/2022/12/Streamlit-Zoom-Map-1024x248-2.png)

1. Finally putting everything together and show the final Streamlit application with the Folium map, showing the circuits in the selected area.

![Finally putting everything together and show the final Streamlit application with the Folium map, showing the circuits in the selected area.](https://www.daanalytics.nl/content/images/2022/12/Streamlit-Final-Map-1024x431-2.png)

### Closing Statements

The previous example provided the steps to plot F1 Circuit Locations into a map using Folium; a Python library used for visualizing Geospatial Data. In this example I added some interactivity with Streamlit. Please check it out and let me know what you think. The code is on [Github](http://python/streamlit/F1FoliumCircuits.py?ref=daanalytics.nl).

I also tried to set things up in Streamlit Cloud. Unfortunately at time of writing I have ran into issues, which I am unable to solve, yet. I am currently trying via some experts on the [forum](https://discuss.streamlit.io/t/plotting-f1-circuit-locations-into-a-map-on-streamlit-cloud-using-folium/34758?u=daanalytics&ref=daanalytics.nl).

Till next time.

[Daan Bakboord – DaAnalytics](https://www.linkedin.com/in/daanbakboord?ref=daanalytics.nl)