This tutorial aims to help GIS users to get started with Python programming for QGIS 3. In contrast to many tutorials out there, the idea is to not assume any previous programming knowledge.
If you found this tutorial on your own, you probably won’t require much external motivation to give this programming thing a go. (If you do, check out “Benefits of Learning Python”.) Python is a great versatile programming language that is widely used in the GIS world and beyond. Knowing how to program will enable you to be more efficient by automating workflows and making your work reproducible.
Unlike many introductions to Python, this one does not start with an installation and setup guide. Why? Because if you have installed QGIS, you already have a working installation of Python on your system. All you need to get started is to launch QGIS and open the Python console (Plugins | Python console).
If you are looking for a more classical introduction, I strongly recommend Gary Sherman’s PyQGIS Programmer’s Guide.
- Hello world!
- Loading a vector layer
- Viewing vector layer attributes
- Filtering features
- Styling vector layers
- Loading a raster layer
- Running Processing tools
- Exporting layouts
This is a work in progress. I’d appreciate any feedback, particularly from beginners!
- Univ. of Helsinki Geo-Python course & Automating GIS-processes course
- HSR Rapperswil QGIS Python GeoPython workshop