Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Creating Web Maps From Your Data With Python Folium (Summary)

Well done making it to the end of this video course! You built a choropleth map using Python’s Folium library. At the same time, you trained your data visualization skills and added Folium as a new tool to your tool belt.

In this video course, you’ve learned how to:

  • Create an interactive map using Folium and save it as an HTML file
  • Choose from different web map tiles
  • Anchor your map to a specific geolocation
  • Bind data to a GeoJSON layer to create a choropleth map
  • Style the choropleth map

If you’re working with data that has a geographical component, then try to use Folium to visualize it and gain additional insights. Additionally, you can create a report that your colleagues and the Internet will want to look at and that you can share as a static website.

Did you like using Folium to visualize your data? Did you work with a different dataset? What features of the library would you like to learn more about? Leave a note in the comments below and keep on mapping!

To continue visualizing data with Python, check out the Data Visualization With Python Learning Path.

You might also like some of these mapmaking libraries:

If you enjoyed working with a Jupyter Notebook, then Using Jupyter Notebooks is the Real Python course for you. In it, you’ll learn how to create and share documents with this powerful web application.

Download

Sample Code (.zip)

16.6 MB
Download

Course Slides (.pdf)

4.9 MB

00:00 In this summary lesson, you’ll review what you’ve learned about Folium and compare it to other Python libraries for mapmaking. Throughout this course, you worked with Folium, a Python library to build interactive maps.

00:15 Folium is a wrapper for the popular JavaScript map library Leaflet.js. That means that you’ll be able to produce maps with Leaflet functionality, but instead of writing in JavaScript, you’ll code in Python.

00:29 You’re also able to easily save your Folium maps as HTML files, which can then be rendered in your browser or served up as a website for your end user.

00:42 Folium allows you to customize your maps in many ways. You updated the web tiles, added boundary layers, included markers with tooltips, and built choropleths to represent data with color.

00:55 You went on to further style your choropleths by changing their color scheme and opacity, along with the spacing of the bins for each color. While we didn’t cover it in this course, you can also add layer control elements to your Folium maps so that your user can toggle between adding and removing layers of your map, like the choropleth.

01:17 Hopefully you’ve found Folium easy to use when creating interactive choropleth maps, but there are other Python libraries for creating maps, each with their own merits.

01:28 GeoPandas extends the pandas library to comfortably work with geospatial data. It also inherits from many other libraries, such as Shapely and Fiona, and can be used in conjunction with Mapplotlib or Folium for plotting.

01:45 Plotly allows you to create bubble maps, choropleth, and other types of maps from your data with customizable tooltips and styles. Plotly has the added benefit that its maps can be integrated into Dash applications so that end users can interact with them further through dropdowns, radio buttons, or other widgets.

02:08 And ipyleaflet combines Leaflet.js with the ipywidgets library. Its syntax is quite similar to Folium. However, you can also add widgets for your end user, such as allowing them to draw a line or shape on the Leaflet map.

02:25 And there are many more Python libraries that you can explore to build up your mapmaking skills.

02:33 Or if you want to learn more about data visualization in general, check out the Real Python Data Visualization With Python learning path. It includes information about several useful visualization libraries, like Matplotlib, Seaborn, Bokeh, and Dash.

02:52 This concludes Creating Web Maps From Your Data With Python Folium. Thanks for joining, and have fun creating your own interactive maps.

John Rutledge on July 25, 2023

Thank you, Kimberly. Really enjoyed the tutorial!

I have been working on a Django website and using Leaflet.js to create an interactive map, but I was coding a lot of Javascript in my Django template. I will try to refactor my code so I do more Python code with Folium in my view and less Javascript in my template!

Become a Member to join the conversation.