DEV Community

fadwamahmoud
fadwamahmoud

Posted on

GeoPandas: The building blocks

GeoPandas:
According to the documentation, GeoPandas is an open source project to make working with geospatial data in python easier. GeoPandas extends the datatypes used by pandas to allow spatial operations on geometric types, but first things first:

-what is Pandas?

Pandas: Data analysis lib(kinda like excel for python!). geopandas just adds geospatial abilities to pandas.

-why use geopandas?

gepandas uses a lot of different libraries and combines them so we don't have to think about them separately, it does all the hard work.
tip: We should know about all those libraries though, because when we want to do smth specific, we'll just reach past geopandas into maybe fiona so I can for example manipulate the file first before using it in geopandas. This makes us a lot more powerful.

-why do we need all those libraries?

When people deal with geographic shapes and files, they tend to use specific software packages that aren't necessarily in python. However, these tools are great so python libs just plug into them. that's why a lot of python packages are built on some non-python software (actually this is why the hardest part about geopandas is actually installing geopandas).

-what libraries is geopandas built on?

1.shapely: lib deals with geometric shapes such as lines, polygons and points. Shapely is built on another library called geos (geos: non-python software that does the heavy lifting of geometry for shapely).
2.fiona: software package for reading and writing files (all types of files geographic formats except for csv file for some weird reason!). It's basically an interface for GDAL/OGR (translation lib for reading and writing raster and vector geospatial data formats).
3.pyproj: cartographic projections, keeps track of different techniques and coordinate systems. It's built on PROJ4.
4.descartes: visualization lib; takes data and turns it into maps works hand in hand with matplotlib(python visualization lib).
5.geopy: package for geocoding; it converts addresses to lat and long pairs.
6.archery: simple spatial analysis. Things like whether a point is inside a polygon or a road goes through a neighbourhood.
7.pysal: open source lib of spatial analysis functions (more advanced spatial analysis) and mostly used for coloring maps.
8.numpy: math lib, pandas uses it for computational work.

ps: this post is mostly a transcript for this video, part of an amazing geopandas course by Jonathan Soma on youtube https://youtu.be/9qxXk2JxsqA?list=PLewNEVDy7gq3DjrPDxGFLbHE4G2QWe8Qh

Top comments (0)