Python is the most popular programming language among GIS professionals. As a matter of fact, it has been adopted as a standard language in GIS because of its powerful data manipulation features and the ease of usage. Of all GIS programming languages, many consider it to be the front-runner.
Successful GIS analysis requires selecting the most appropriate tools to operate on your data. To help you in selecting the right tools for your GIS automation tasks, I have put together a list of amazing python libraries that can be used for all forms of geospatial processing and analysis.
1. ArcPy
ArcPy is the most popular Python library for geospatial purposes. ArcPy is a Python site package that provides a useful and productive way to perform geographic data analysis, data conversion, data management, and map automation with Python. Basically, if you ever find yourself working with any of the ESRI mapping products (ArcGIS Desktop and ArcGIS Pro) and wishing that you didn’t have to do all the little steps manually every single time, then you’re going to love ArcPy.
2. PyQGIS
PyQGIS is Python API provided by QGIS . QGIS is a great software for the processing/analysis of spatial data. It comprises of a set of QGIS libraries plus the Python tools with the potential of running other powerful libraries like Pandas, Numpy, or Scikit-learn. The PyQGIS Developer Cookbook can be used as both a tutorial and a reference guide for anyone looking to get started with PyQGIS. While it does not list all possible use cases, it gives a good overview of the principal functionality.
3. GeoPandas
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. Geometric operations are performed by shapely . Geopandas further depends on fiona for file access and descartes and matplotlib for plotting. GeoPandas enables you to easily do operations in python that would otherwise require a spatial database such as PostGIS.
4. GDAL/OGR
GDAL is a translator library for raster and vector geospatial data formats. Actually, the GDAL python package is made up of two libraries – GDAL for manipulating geospatial raster data and OGR for manipulating geospatial vector data – but the entire package is been referred to as the GDAL library. The Python GDAL/OGR Cookbook has simple code snippets on how to use the GDAL/OGR API.
5. Shapely
Shapely is a Python package for the manipulation and analysis of planar geometric objects. It is based on the widely deployed GEOS (the engine of PostGIS) and JTS (from which GEOS is ported) libraries. The first premise of Shapely is that Python programmers should be able to perform PostGIS type geometry operations outside of an RDBMS. Shapely is not concerned with data formats or coordinate systems but can be readily integrated with packages that are.
6. Rasterio
Rasterio is a highly useful module for raster processing which you can use for reading and writing several different raster formats in Python. Rasterio is based on GDAL and Python automatically registers all known GDAL drivers for reading supported formats when importing the module. The most common file formats include for example TIFF and GeoTIFF, ASCII Grid and Erdas Imagine .img -files.
7. pyproj
pyproj is a python interface to PROJ. PROJ is a cartographic projection and coordinate transformations library. Input coordinates can be given as python arrays, lists/tuples, scalars or numpy/Numeric/numarray arrays. Optimized for objects that support the Python buffer protocol (regular python and numpy array objects).
8. PyShp
The Python Shapefile Library (PyShp) provides read and write support for the Esri Shapefile format. The Shapefile format is a popular Geographic Information System vector data format created by Esri.
9. Fiona
Fiona reads and writes geographic data files. Fiona contains extension modules that link the Geospatial Data Abstraction Library (GDAL). It focuses on reading and writing data in standard Python IO style and relies upon familiar Python types and protocols such as files, dictionaries, mappings, and iterators instead of classes specific to GDAL’s OpenGIS Reference Implementation (OGR). Fiona can read and write real-world data using multi-layered GIS formats and zipped virtual file systems and integrates readily with other Python GIS packages such as pyproj, Rtree, and Shapely.
10. PyGEOS
PyGEOS wraps GEOS geometry functions in numpy ufuncs. PyGEOS is a Python library with vectorized geometry functions. The geometry operations are done in the open-source geometry library GEOS. PyGEOS wraps these operations in NumPy universal function (ufuncs) providing a performance improvement when operating on arrays of geometries.
11. GeoFeather
Geofeather is a Python library for faster geospatial I/O with GeoPandas. One of its most powerful features is that it allows you to work with geospatial data using a similar approach to working with row-level data in Pandas, which is one of the fundamental data science libraries in Python. Geofeather was developed by Brendan Ward . According to him, the project exists because reading and writing standard spatial formats (e.g., shapefile) in geopandas is slow.
12. PySAL
Python Spatial Analysis Library ( PySAL ) is an open-source cross-platform library for geospatial data science with an emphasis on geospatial vector data written in Python. It supports the development of high-level applications for spatial analysis, such as:
- detection of spatial clusters, hot-spots, and outliers.
- construction of graphs from spatial data.
- spatial regression and statistical modeling on geographically embedded networks.
- spatial econometrics.
- exploratory spatio-temporal data analysis.