If you like what we're working on, please  star us on GitHub. This enables us to continue to give back to the community.


The term “geographic data” refers to any information that may be used to determine or describe a specific geographical place. As it is a physical site, we may depict it on a map. Using python libraries, it’s simple to create a map that displays any kind of geographic data.

Python offers many open-source modules for the display of geographical data. These Python map libraries are simple to use and generate maps that are extremely dynamic and aesthetically beautiful.

  • Folium is a robust Python package that facilitates the creation of several kinds of Leaflet maps. 

Folium Python generates the map as a standalone HTML file by default. Due to the interactivity of Folium’s output, this library is a great resource for constructing visualizations. Folium also supports the creation of inline Jupyter maps.

Folium leverages the powers of the Python environment for data manipulation and the skills of the Leaflet.js library for mapping. With Folium, you may use Python to edit your data and then use Leaflet to display the results on a map.

Folium allows you to construct a base map with a defined width and height using preset tilesets (i.e. map styles) or a custom tileset URL. You may use Folium with these tile sets out of the box:

  • Mapbox
  • Mapbox Control Room
  • Mapbox Bright
  • OpenStreetMap
  • Stamen
  • Cloudmade
  • CaroDB

Additionally, the Folium package in Python supports choropleth maps. A choropleth map, named from the Greek words for “area” and “multitude,” displays statistical data like population density or per-person income by shading or patterning different parts of the map following the value of the metric being presented.


Install Folium using the pip install folium command.

Importing necessary library

You need to import folium, which has all the functions necessary for the display of geographical data.

  • import folium

Exploring Folium

You should begin your investigation of folium by constructing a global map in a single line of code.

  • world_map = folium.Map()

Similarly, you may generate maps for other places by just providing their relevant longitude and latitude. You may Google your location’s latitude and longitude coordinates.

Using Markers for World Map

Using the marker function, you may add a flag on the map for a specific place while creating a globe map using Markers Folium. On a globe map, you may explore it by circling the capitals of a few nations.

Types of Map

Folium supports many map formats that depict distinct properties such as roads, rivers, etc. in a straightforward manner.

First, examine the Stamen Toner map, which is a high-contrast black-and-white map that makes it easier to see river meanders and coastal zones, followed by the Stamen Terrain map, which depicts hill shading and the natural hues of flora.

It would be evident how well these tiles depict various geographical characteristics. Similarly, there are several other tile styles available on folium layer control.

Folium enables us to generate interactive maps of many kinds and places with a single line of code. The maps may be zoomed in or out to provide a good view of the area and its surroundings.

Final notes

We covered the fundamentals of folium, namely how to construct several maps with distinct styles using a single line of code. We learned how to construct a map marker to indicate a certain spot. We saw how several settings may alter the map’s appearance. But most importantly, we learned that folium is an impressive library for making highly dynamic leaflet maps in a variety of perspectives and styles.

Open source package for ml validation

Build Test Suites for ML Models & Data with Deepchecks

Get StartedOur GithubOur Github

Identifying and Preventing Key ML PitfallsDec 5th, 2022    06:00 PM PST

Register NowRegister Now