Say hello to Geopatra

Posted by StuffonmyMind on February 20, 2020


In case you haven’t cringed at the wordplay yet, yes it’s cleopatra

If I wanna work with data I cannot imagine using anything else than a pandas dataframe, it is my goto and for a reason. geopandas introduces geodataframes that are an extension of pandas dataframes for working with geometries/ geospatial data.

Creating interactive maps outta them is not very easy for a beginner and there are tons of options available. When I wanted to do this I was bombarded with tons of options.. It was like trying to find something to watch on netflix, too many options and even when you finally decide which package you are gonna use, there is an overhead of learing the api i.e how the package works with geopandas. There are tons of tutorials online introducing you to interative mapping with geopandas with «x» where x can be folium, ipyleaflet, mapbox, bokeh, plotly, geoviews etc.

Finally I decided to use folium and wrote little functions to help me plot geodataframes. It was all fun and games till the data got huge. Folium would crash when bombarded with data so I moved to using jupyter and had to start writing these functions again. I am not the only one who loves geopandas.. people love working with dataframes cause it is fast, familiar and honestly has an amazing community of helpful developers.

I started working on Geopatra by stitching up my scripts for folium. I am planning to add more packages and hopefully come up with a framework where geopandas could quickly interact with most of the existing mapping libraries so that the end user doesn’t have to care about how they work

I have done this for folium and honestly I have no idea how to implement the intricate control you have over the map with folium. If you are perfectionists looking for awesome maps where you control everything then geopatra is not for you. It is for quickly creating maps, it is for someone looking to quickly hack up a map without spending time understanding how «x» package works


learning how mapping libraries like folium work just to plot my geodataframe was too much for my lazy ass I want it to be as easy as df.folium.plot()


import folium
import geopandas
data = geopandas.datasets.get_path('naturalearth_lowres')
world = geopandas.read_file(data)
m = folium.Map(location = [4,10], zoom_start = 3)

With Geopatra

import geopatra
m = world.folium.plot()

Tbh, this package is just a gigantic wrapper and nothing remotely cool is happening but it made my life easier and hopefully does the same for someone else too