Beginning to make progress with learning PyQGIS

Beginning to make progress with learning PyQGIS

Since writing my last post, I have both gone on to do another tutorial with qgistutorials.org as well as give the book PyQGIS Programmer’s Guide another try.

In this tutorial from qgistutorials.org, I used a custom Python expression and the map tips feature in QGIS to display the name and UTM zone of a city when you hover the mouse over it (shown in the feature image of this post).

The tutorial itself was easy, since it wasn’t about learning to write the code itself, just how to add the custom expression in QGIS. Still, I retyped the given code into a notepad as a learning exercise.

I’ve also made another attempt to learn from The PyQGIS Programmer’s Guide by Gary Sherman, and this time has had more momentum. The first attempt I was daunted by everything it instructed to do to set up the development environment, such as having Qt5 and having qgis installed in a directory without any spaces in the path, etc. It was a lot to take in. But I took it bit by bit and googled a lot of things, and got past it. I realized that OSGeo4W contains everything I need, and I re-downloaded it to a directory which contains no spaces.

I’ve been going through the book page by page, with QGIS open and looking at both as I go. I go really slow and I google a lot. I’m on page 99 now, and I’ve learned a lot. A lot of what I’ve learned has been separate from the content, just googling stuff I didn’t understand and reading about this and that. (For example, “what is ogr” and “what is a provider” and “why does my computer’s file paths have backslashes instead of forward slashes”.)

The screenshot below was when I was using PyQGIS to add and style layers on the canvas. That was exciting, because it finally felt like I was doing PyQGIS.

Comments are closed.