How to merge Polygons using Geopandas?

And the basics of this library

Josep Ferrer
6 min readJul 23, 2022

--

Today I am writing a completely different scope to share with you some technical procedures I have been discovering lately. In my job as a Data Analyst, I have been working with geospatial data using the Geopandas library.

In case you don’t know it yet, Geopandas is a python library and its main functionality is to make working with geospatial data in python easier.

It combines the powerful features of Pandas to use DataFrames and of Shapely to work with geometrical data, providing geospatial operations with the familiar syntax of Pandas while extending its functionality to work with geometries and create beautiful maps.

These geometric operations are performed by Shapely and it further depends on Fiona for file access and Matplotlib for plotting.

It is a wonderful library that I have used intensively during these last months mainly to generate regional boundaries stored as Polygons. So, what’s a Polygon?

You can find a technical answer for this question directly here on the Shapely documentation. However, to make it easy to understand, a polygon is a Shapely class that contains a set of points that defines a geometrical shape that is geolocalized. This can be used to emulate countries and regions boundaries using this type.

Self-made gif.

--

--

Josep Ferrer

Crush into the world of data with DataBItes: databites.tech | Outstand using data. ML, SQL, Python and DataViz | 👉🏻Inquiries in rfeers@gmail.com