 Welcome back in the open course programming for geospatial hydrological applications. I'm Hans van der Kwaas, your lecturer. In module 5 we are going to work with PyQGIS. This lecture gives a short introduction. QGIS is packaged with Python. You can access the Python console by going to the Plugins menu and choose Python Console. There you can use Python with the installed libraries, which of course also includes Python functions of QGIS. PyQGIS. Instead of just writing line by line, you can click this button to open the editor. It's a simple IDE where you can write your scripts, such as this one. And there you can mix all kinds of Python libraries that are installed with QGIS and PyQGIS to make new tools. But there's more. If you go to the Processing Toolbox, you can find the Python icon. There we can create a new script, which will open the IDE. Or we can create a new script from Template, and the template can be used to create your own processing tools with an interface. And it's really easy to add an interface using this template. You can even make plugins in that way. Another nice thing is that every time you run a processing tool, like in this example we use the Strahler order, it stores the history. So here you can find the tools that you have run. And the nice thing is it creates a Python dictionary where you can replace certain parts with your variables. So instead of programming the whole tool, you can simply use this dictionary that is found in the history of the Processing Toolbox. And include it in your own tools. And there's even more. There's the Graphical Modeler, where you can create your own graphical models by dragging and dropping inputs and processing algorithms and connecting them to each other. And in that way you can make a nice workflow. But a really nice option there is that you can export the graphical model as a Python script. And here you see the Python script of stream delineation, and you recognize the dictionaries with the inputs and the variables from the interface. So this is an easy way to develop your tools with Python exported from the Graphical Modeler, modifying it further, and even creating your own plugins with this method. Another nice thing that I want to show is that you can install QGIS in Anaconda. I've made an environment with QGIS and PC Raster and some other libraries. And the great thing is that in this way I can access the libraries in the environment from QGIS. And the other way around, I can use PyQGIS in scripts that I run in that environment. And here you see that I have made scripts with interfaces for many PC Raster functions that I can run here from QGIS in Anaconda, because it runs in an environment where I have access to the PC Raster library. Here you see that I can import PC Raster without any problem. So in the tutorials we are going to explore PyQGIS. We're going to use PyQGIS in QGIS. And we also use a Jupyter notebook to run PyQGIS outside of the QGIS interface.