Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Geospatial Open Source Python Libraries

This section lists open-source packages for geospatial file manipulation with Python. The necessary packages are already installed flusstools. In addition, the following paragraphs provide explanations of relevant and optional packages for this eBook and how those can be installed.

OSGeo and GDAL Including ogr and osr

The gdal library for raster data handling comes along with ogr for vector data handling, and osr for geospatial referencing. GDAL and OGR are managed and developed by the OSGeo Project, which is part of the Open Source Geospatial Foundation - the developers of QGIS.

The tutorials in this eBook build on gdal and ogr (including osr for spatial referencing), which is why it is important to get the installation of GDAL right:

Select your platform for more specific installation instructions:

Linux / pip
Windows / conda

GDAL requires sudo-installation. Find more details in the Python installation instructions of this eBook.

geojson

The geojson library is the most direct option for handling GeoJSON data and is also already installed along with flusstools.

Linux / pip
Windows / conda

To install geojson, open Terminal and type:

pip install geojson

Descartes Labs

Even though of proprietary origin, the descarteslabs library (developed and maintained by Descartes Labs) comes with many open-sourced functions. Moreover, Descartes Labs hosts the showcase platform GeoVisual Search with juicy illustrations of artificial intelligence (AI) applications in geoscience. Note that descarteslabs is not installed along with flusstools.

Linux / pip
Windows / conda

To install descarteslabs, open Terminal and type:

pip install descarteslabs

Python Imaging Library (PIL) / pillow

Processing images with Python is enabled with the Python Imaging Library (PIL). PIL supports many image file formats and has efficient graphics processing capabilities. The pillow library is a user-friendly PIL fork and provides Image* modules (e.g., Image, ImageDraw, ImageMath, and many more). If flusstools is installed, no further action is required for working with the PIL/pillow-related contents of this eBook.

Note that the conda base environment includes PIL (test with import PIL), which needs to be uninstalled before installing pillow. For installing PIL/pillow, refer to https://pillow.readthedocs.io.

shapely

A preferable and very well documented package for Shapefile handling is shapely. shapely is already installed along with flusstools.

Linux / pip
Windows / conda

To install shapely, open Terminal and type:

pip install Shapely

pyshp

pyshp is another shapefile handling package, which builds on pure Python code (rather than wrappers) to simplify direct dealing with shapefiles in Python. pyshp is already installed along with flusstools.

Linux / pip
Windows / conda

To install pyshp, open Terminal and type:

pip install pyshp

Other packages

Besides the above-mentioned packages, there are other useful libraries for geospatial analyses with Python (Packages in bold red font are installed along with flusstools):