Python Essentials training
An introduction to thinking in a Pythonic way covering the fundamentals of the language and putting you in good stead for the Python for QGIS training course.
Installation, executing scripts and using the interpreter
Imports, functions, indentation and variables
Strings, if condition
Exercise – basic/stringl.py
Lists and looping
Sorted function, Tuples
Exercise – basic/stringl.py
Dicts and files
Dicts, Reading and writing files, Extra: Using with context manager, Unicode Errors Simply Explained
Exercise – basic/wordcount.py
Exercise – babynames/babynames.py
The standard library
File System, Errors and Exceptions, HTTP (optional)
Exercise – copyspecial/copyspecial.py
Exercise – logpuzzle/logpuzzle.py (optional)
Introduction to classes
Installing packages via pip (python -m pip)
Postgres using psycopg, Python psycopg2 & PostGIS
Find a Python training course to suit you
Python for QGIS training
A one day course covering using Python to interact with and extend QGIS. This course assumes some prior knowledge of Python (such as our Python Essentials course) and a basic familiarity with QGIS to really maximise your implementation.
1 day4 CPD points
Introduction to Python
A quick refresher on what Python is and a look at some of its key features. This course assumes that you have
some skills in programming (preferably in python) and are looking to understand how to use Python with QGIS.
Introduction to PyQGIS
QGIS has a powerful programming interface that allows you to extend the core functionality of the software as
well as write scripts to automate your tasks. QGIS supports the popular Python scripting language. Even if you
are a beginner, learning a little bit of Python and QGIS programming interface will allow you to be much more
productive in your work.
Using the QGIS Python Console
QGIS contains a full installation of Python that is available in the console, this section gives an introduction to its use in interacting with data layers and features to allow you to enhance your data
exploration and mapping.
It is possible to add simple functionality to QGIS using the command console to write custom functions that
modify attributes of your features. This section will show you how to write and deploy a custom function to
calculate the UTM zone number of a point on the map.
PyQGIS is the Python API provided by QGIS to allow programmers direct access to all of the QGIS interface.
Here we will look at the possibilities provided by the API to control QGIS, access and modify data.
Creating a plugin
In the final session of the course we work through two fully working scripts, a plugin to provide a new tool for QGIS users and a new processing script to add a custom process to the processing tool box.
Join our online Python training courses
Meet the author
Matt has been working with Python since 2011 and is the author of the Open Source GML Loader and provided commits to other projects such as MapProxy.
He has a passion for open source and regularly provides workshops at various open source events.