Daanalytics

Plotting F1 Circuit Locations into a map using Folium

The notebook below is a continuation of a previous blogpost where I started loading F1 Data into Snowflake ❄️ using the Ergast API. Next up is plotting this data on a map using Folium. Folium is a Python library used for visualizing Geospatial Data. *”It builds on the data wrangling strengths of the Python ecosystem and the mapping strengths of the Leaflet.js library. Manipulate your data in Python, then visualize it in a Leaflet map via folium.”*

Follow the steps below to get things started.

  • I use an Anaconda environment from where I have started Jupyter Lab.
  • Next install all the necessary library’s
  • Import necessary library’s
  • Create a function to get a Continent based on the Country and 
  • Create a function to define the marker color based on the Continent
  • Setting up a Snowflake connection
  • After setting the connection to Snowflake it’s time to connect to the database, verify the connection and get the data out of the Circuits-table
  • Convert the Data output to a Pandas Data Frame so we can plot this Data on a Folium Map
  • Create the Folium Map. In this example 3 different variants:
    • World Map
    • Continent Map (Europe)
    • Country Map (France)

The above notebook results in the below maps.

World Map

Continent Map (Europe)

Country Map (France)

Closing Statements

This example provided the steps to plot F1 Circuit Locations into a map using Folium; a Python library used for visualizing Geospatial Data. Please check it out and let me know what you think. The code is on Github. In a next example I will covert this code into a Streamlit Application.

Till next time.

Daan Bakboord – DaAnalytics

Bekijk ook:

Amsterdam User Group Meeting October 2024

Snowflake Dutch User Group – October 2024

Last night I had the privilege to organize a Snowflake ❄️ User Group in Snowflake’s Amsterdam Office.

Johan van der Kooij shared his experiences regarding optimizing Snowflake from a cost & performance perspective. He shared practical hints, as well as example queries, that you can use to optimize your Snowflake environment.

Lees verder »
Snowflake Data Cloud Summit - Wrap Up

Snowflake Snowflake Data Cloud Summit — Wrap Up

Snowflake Data Cloud Summit proved that after all this years the core idea remains the same and is still strong. Technology should serve and Snowflake makes things simple. One Single Unified Platform, one product and one engine. Ease of use and Govenance. Maximum efficiency and maximum simplicity.

Bring the processing of data to the data instead of the other way around. Snowflake as a Platform where you build and share your Data, Apps and AI Products. Your data never has to leave the Platform and Snowflake takes care of this Platform.

Lees verder »
Snowflake Data Cloud Summit - Day II

Snowflake Data Cloud Summit – Day II

The second day of Snowflake Summit in the Moscone Center in San Francisco started with Platform Keynote packed with announcements and demo’s. The announcements were not necessarily completely new, but a continuation of things Snowflake was already working on. Lot’s of Developments and Previews have made it to GA status and are now Generally Available to the public. A few announcements were made as wel.

This blogpost a summarization of my notes with were possible a link to Snowflake publications or documentation.

Lees verder »