This section gives a quick introduction on how to use Python in QGIS. Credits to Tatu Leppämäki for compiling these materials!

Learning objectives

The aim of this lesson is to get started with using Python in QGIS. You will learn to run code from QGIS Python console, and learn how to create a simple QGIS plugin that applies Python functions.


There is no exercise in week 6! You can now continue to the Final Assignment. Also, please find additional materials related to raster data processing on these course pages.

Lecture videos

AutoGIS 2019 Lesson 7 - Python in QGIS; building a simple QGIS plugin

Tatu Leppämäki, University of Helsinki @ AutoGIS channel on Youtube.


  • General intro for lesson 7 0:00

  • Python in QGIS intro 4:10

  • Opening a WFS layer in QGIS 7:00

  • Changing the crs of the WFS layer 08:35

  • Python console in QGIS 10:18

  • Basic python commands in QGIS 11:20

  • Python script files in QGIS 22:10

  • Installing plugins for creating plugins 27:00

  • QGIS plugin builder 30:35

  • Compile required files using a batch file 37:50

  • Restart QGIS and activate plugin 43:50

  • Add a Python function to the plugin 46:35

  • Design the graphical user interface of the plugin using qt designer 50:30

  • Connect the Python function and the user interface 56:30

  • Reload the plugin 1:00:35

  • Run the plugin 1:01:05

  • Summary 1:02:00

  • Additional resources 1:03:10

  • Additional PyQGIS functions 1:04:17

  • Example of a more complicated plugin (GeoCubes): 1:06:30