Python for GIS

Clicking through the same QGIS processing chain every month is a job for a script. We cover the Python geospatial stack from a single point to a national raster, then plug it into the tools you already use: QGIS, PostGIS and web maps.

Duration: 3 days · Level: intermediate

For: GIS technicians, geomaticians and data analysts working with geographic data.

Prerequisites: knowing the basics of Python and of GIS (layers, coordinate systems).

Python for GIS

Day 1 — Vector data

  • The geospatial Python landscape
  • Points, lines and polygons with shapely
  • Buffers, intersections and unions
  • GeoPandas: a DataFrame that knows geography
  • Reading and writing shapefiles, GeoPackage and GeoJSON
  • Coordinate systems and reprojection with pyproj
  • Spatial joins
  • Dissolving and aggregating by area
  • Quick maps with GeoPandas and matplotlib

Day 2 — Rasters and databases

  • Raster data with rasterio
  • Windows, masks and clipping by a polygon
  • Raster maths and zonal statistics
  • Rasters and vectors together
  • PostGIS: the spatial database
  • Querying PostGIS from Python
  • Pushing the heavy lifting to the database
  • Large datasets: tiling and spatial indexes

Day 3 — QGIS and the web

  • The QGIS Python console
  • Scripting QGIS with PyQGIS
  • Automating a processing chain
  • Writing your own processing algorithm
  • Interactive web maps with folium
  • Geocoding addresses
  • Sharing results: exports, map images, reports
  • Workshop: from raw data to a published map

Elevate Your Python Proficiency!