This tutorial aims to help GIS users to get started with Python programming for QGIS. 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. Python is a great versatile programming language that is widely used in the GIS world an 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 start 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


This is a work in progress. I’d appreciate any feedback, particularly from beginners!

External resources



  1. Adrian said:

    Looks very promising

    • Thank you for your feedback! If you have any specific questions or ideas, let me know.

  2. Matt M said:

    This is great!

    Just a few ideas…

    Do one for writing an entire script that loads a few layers and does some sort of processing on it. The individual tasks you complete are an important foundation, this adds even more practicality.

    And then maybe write one explaining commonly used structures/logic of scripts, such as looping through features in a layer, creating new calculated columns. This enables learners to apply pyqgis to numerous problems.

    Lastly I’d love to see one for writing a script and then setting up a UI/Dialog Box for user input and how to add it to the processing toolbox.

    Your work is awesome!

    • Thank you Matt! More loops are certainly on my todo list, as is using Processing tools from code. Creating a Processing script from scratch will probably be a bit further down the line.

  3. Raúl said:

    I was looking for some like this just to start working with pyqgis. I like this who much!!!!
    Also I agree with the third idea by Matt…
    Thank you for this work!!!

  4. John said:

    Anita, Pretty much anything you do I will check out. Just try an remember, most of us are not even in the same realm of brilliance as you. Keep us dullards in mind.

  5. Hi Anita,
    A few Raster examples can also be nice.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: