Automated GIS Workflows with QGIS & Python

The goal of the module “Automated GIS Workflows with QGIS & Python” is to introduce the use of QGIS for typical GIS tasks, such as data visualization, editing, and analysis. Course participants will also learn to use Python (in particular the QGIS Python API PyQGIS) to automate GIS workflows. Concepts that lend themselves to automation are first introduced using the QGIS GUI based on “Discover QGIS” 2nd edition by Kurt Menke. We then build on these introductions and learn how to automate our workflows using PyQGIS. This module was first introduced at UniGIS in 2015 and is currently in its 3rd edition (released 01/2023).

Please note the prerequisites of the module.

See a short presentation of the module and recent updates by the lecturer (webinar recording):

At the end of this module, participants will be familiar with the use of Python to write scripts using the PyQGIS API to automate analysis and map production and to extend QGIS with their own interactive Python-based actions, algorithms, and even plugins. Python is a great versatile programming language that is widely used in the GIS world and beyond, so the experience from this module will be helpful far beyond the QGIS context.

Previous Python or programing knowledge is required. If you are not sure whether you qualify, please contact martin.loidl@plus.ac.at.

This is an exclusively english language module, hence any kind of communication with the module lecturer should be in English. A discussion forum is maintained in Moodle in order to support efficient module instruction. You are requested to submit all your questions related to this module to this forum only. The lecturer will check all incoming comments on a regular basis and will answer your questions or provide you with pointers for solving your problems. The module is delivered in form of an instructed self-study. Reading materials and hands-on examples are complemented with multimedia elements. Upon completion of the module students are requested to evaluate the module, which is a part of our quality assurance policy and practice.

  • Software: QGIS
  • Literture: Kurt Menke “Discover QGIS 3.x – Second Edition” (2022).

No special requirements

The module is structured in 15 lessons with 7 assignments. Lecturer assessment reflects student’s achievements in this module and is conducted through assessing module assignments. Assignments must be submitted in written format within the required time period. Lesson exercises are designed to enforce students’ knowledge and skills. These should be completed to allow students to assess their own progress and are not included in the module assessment.

Lesson 1 - Introducing QGIS
This first module lesson provides an introduction to the basics of QGIS. The key topics of this lesson are:
– Getting to know the QGIS project
– Getting to know the QGIS desktop application
– Revisiting spatial data models
– Displaying spatial data in QGIS

Lesson 2 - Introducing PyQGIS
This second lesson marks the start of our joint journey into PyQGIS. The key topics of this lesson are:
– Getting started with Python in QGIS, a.k.a. “Hello world”
– Loading our first vector layer
– Viewing vector layer attributes
– Loading raster layers
– Managing project layers

Lesson 3 - Creating spatial data
This lesson is a deep dive into creating spatial data. The key topics of this lesson are:
– Georeferencing map images
– Digitizing vector features from georeferenced map
– Using snapping tools to avoid topological issues
– Achieving a CAD-like experience using advanced digitizing tools and construction mode

Lesson 4 - Creating vector layers using PyQGIS
This lesson we explore how to create vector layers using PyQGIS. The key topics of this lesson are:
– Creating a new layer from scratch
– Adding features to our layer
– Adding additional attributes to our layer
– Styling vector layers

Lesson 5 - Introduction to spatial analysis
This lesson introduces some of the essential spatial analysis tools for raster and vector data provided by QGIS. The key topics of this lesson are:
– Handling remote sensing data
– Performing unsupervised classification
– Filtering vector layers by attributes
– Buffering and clipping vector data
– Creating a map of analysis results

Lesson 6 -Joins, queries & actions
This lesson continues on the topic of spatial analysis. The key topics of this lesson are:
– Setting up table joins
– Classifying dataset features for visual analysis
– Performing attribute and spatial queries
– Using actions to interact with our data
– Writing our own custom actions

Lesson 7 - PyQGIS for spatial analysis
This lesson shows you how to perform spatial analysis using the PyQGIS API. The key topics of this lesson are:
– Performing attribute queries
– Viewing query results
– Running Processing tools
– Chaining Processing tools to perform multiple analysis steps

Lesson 8 - Overlay techniques & processing models
This lesson discusses advanced spatial analysis techniques. The key topics of this lesson are:
– Performing overlay operations
– Creating automated geoprocessing models using the QGIS model builder

Lesson 9 - ProcessingAlgorithm scripts
This lesson brings together the power of models and scripts. The key topics of this lesson are:
– Exporting a model as a Python script
– Customizing scripts created from models
– Writing Processing scripts from scratch

Lesson 10 - Network & raster data analysis
This lesson dives into advanced spatial analysis for network and raster data. The key topics of this lesson are:
– Computing shortest paths using street network data
– Generating service areas and isochrones
– Performing terrain analysis
– Reclassifying rasters
– Using the raster calculator

Lesson 11 - Map design
This lesson provides an introduction to designing print maps in QGIS. The key topics of this lesson are:
– Designing maps
– Assembling a print layout with proper map items (such as legend and scale bar)
– Speeding up map creation using templates
– Automating map creation using the Atlas (map series) feature

Lesson 12 - PyQGIS for automated map creation
This lesson shows how export map as images or PDF using PyQGIS. The key topics of this lesson are:
– Exporting the current map canvas
– Customizing the map canvas export
– Exporting print layouts (formerly known as print compositions)

Lesson 13 - Advanced spatial data visualizations
This lesson dives into advanced spatial data visualizations. The key topics of this lesson are:
– Using Live Layer Effects
– Applying Blending Modes
– Leveraging Geometry Generators

Lesson 14 - Writing custom functions for expressions
This lesson shows how to write custom Python functions to extend the range of functions we can use in our expressions. The key topics of this lesson are:
– Basic functions operating on input parameter values
– Functions operating on the feature geometry
– Functions operating on feature attributes

Lesson 15 - Plugin development
In this final lesson, we take our learnings from the previous PyQGIS lessons to the next level and learn how to create our own plugins. The key topics of this lesson are:
– Understanding the necessary parts of a minimal plugin
– Creating a Processing plugin