Diskussion:Workshop QGIS Python GeoPython 2018

Aus GISpunkt HSR
Wechseln zu: Navigation, Suche


GitHub repository: <>

Program Overview

  1. 5 min: Welcome and Introduction
  2. 5 min: Intro to QGIS
  3. 25 min: Intro to Processing framework
  4. 45 min: Creating custom scripts with Hands-on Exercises
  5. 15 min: Wrap-up & Conclusion

Welcome and QGIS Installation (5 min)

  1. Welcome everybody into the workshop, and introduce each other (name, country, what they do, etc)
  2. Make sure everybody has successfully installed QGIS 3.0 from the website (GitHub repo as well as workshop materials will provide the link)
  3. Help out anyone who has any problems installing QGIS 3.0
  4. Basically a buffer time so everybody can settle down before we begin properly

Intro to QGIS (5 min)

  1. Stefan's

Intro to Processing Framework (25 min)

  1. What is Processing Framework?
  2. Why is Processing needed? What is its history?
  3. Goals and motivation
  4. The framework itself and how it works
  5. The features of Processing
  6. Advantages and Limitations

Workflow Introduction (20 min)

  1. Introduction to the autobahn workflow and its datasets, objectives, goals, etc
  2. Show them the steps required to do it manually
  3. Demonstrate certain tools, as well as prior written scripts

Hands on Exercises (60 min)

  1. Hands on exercises, I will be doing it on screen with them for the first half if possible
  2. Try to finish all 6 tasks in 60 minutes
  3. Introduction to bonus material

Wrap up and Conclusion (5 min)

  1. Brief recap
  2. Q&A
  3. QGIS closing
  4. Python closing

Detailed Workshop Plan

See Slides and GitHub for more details

      • outdated ***

I broken them down into bite-sized tasks and there is a progressive flow to it:

  1. Introduce to them the exercise - to create buffer zones and analyze the impacted areas the construction of an autobahn would do to floral habitats
  2. Tell them in brief the steps that we will be doing (adding the geopackage files, creating buffers, performing union on the buffers, query expressions on the outputs, and then intersecting selected features against the initial buffers) along with the expected output
  3. And then, we move on to the 4 different tasks:
  4. Manually add the geopackage files (we will also show them how to add a buffer manually)
  5. Using the graphical modeler to add buffers (we will also show them how to add a buffer usingPyQGIS)
  6. Performing the Union algorithms on the buffers using Python on PyQGIS (we show them how to do it with a script)
  7. Writing a script to select features with a query, and then intersecting them with prior-made buffers
  8. I feel that in this way, they progress from using QGIS manually, to using the graphical modeler, to PyQGIS and then to writing their own script, and it covers from new learners to more adept users of QGIS. We will also show them how to perform a task using the more advanced method before letting them try the next task in that method (showing them how to use PyQGIS in task 2 before letting them do task 3 using PyQGIS)
  9. After they complete these 4 tasks, I would have a bonus task where they can create an interactive script to automate these 4 tasks without having fixed parameters (i.e. have the user define the radius of the autobahn, instead of having it at 20m always)

I have also tried writing everything in a Python script (which I will be using as the master script and also the solution for the bonus task), and so far, it works very well. I am able to:

  1. Ask for user input on the environment and autobahn files to add as layers
  2. Run Processing algorithms to create buffers
  3. Run Processing algorithms to create unions
  4. Run Processing algorithms to perform intersection
  5. Query attributes of a layer with code
  6. Change some basic stylizations of layers with code

To refine it, I am planning to:

  1. Make it more interactive by asking for user input to set as parameters for running the algorithms (quite simple)
  2. Stylize the layers using 'Categorize'
  3. Making the layers explorer more organized and neat

So as you can see, the core of the master script is more or less finished, and I am left with refining it for the workshop Once I have finished creating the GitHub repository and confident in the presentation (hopefully 1.5 weeks from now), may I suggest going through the content with maybe Lucas and Diego in the conference room, just to see if the tasks are manageable and if the entire workflow is coherent?

As mentioned previously, I have updated and translated the Autobahn exercise into English and for QGIS 3.0 although the section on Task 8 is a bit weird because I wanted to remove it initially, but let me know what you think. I have attached it here for your viewing.


Geometa Lab Blogpost:

On the 7-9th of May, the University FHNW in Muttenz near Basel will be organizing the GeoPython conference following the success of the ones held in 2016 and 2017. And of course, we at the Geometa Lab would be present there again, to present a workshop that incorporates our specialty, Geospatial Data Analysis, as well as the programming language we all love - Python! Our workshop is titled "QGIS Processing Framework: Automating Tasks with Python". It will be held at 1330 - 1530 hours on 7 May (weblink to program).

In a nutshell, the workshop seeks to teach participants basic literacy in the geospatial software, introduce the Processing framework of QGIS which includes a Graphical Modeler. This framework consists of native (like SAGA) and custom functions from QGIS, making your spatial analysis tasks more productive and easier to conduct and to automate otherwise repetitive and tedious geospataial analytical tasks. And it allows also to write Python scripts to help create custom scripts.

The workshop will start with self introductions, and then making sure that participants have the right version of QGIS 3.x, which is a rather new and big update to previous iterations. Help with setting up and installing QGIS would also be administered if required. After that, we kick off the actual workshop by introducing QGIS - about QGIS, how it came about, what is a FOSS4G, various other software like QGIS, its pros and cons, future works, etc, and more.

Once participants are warmed up to the idea of QGIS, we then talk about how QGIS can be linked to Python, through PyQGIS, its native built in Python console. We will continue with a quick run-through of its capabilities, from performing basic Pythonic equations to high leveled Pythonic scripts, as well as methods native to the QGIS library. We will also explain how the implementation of the PyQGIS is achieved with the Processing framework as well as how it allows us to create custom scripts, among other nifty tools, like the Graphical Modeler and Plugins, via the Processing Toolbox feature.

And now that we have piqued your interest, we move on to the main event. We will show you the Graphical Modeler, Plugin and Processing Script in action to demonstrate the prowess of QGIS and Python, before letting you get down and dirty by trying out our bite sized hands on created specially to help you through this crash course. Finally, once we have all become considerably versed with automating geodata analysis tasks with scripts, we wrap up and conclude our 2 hour workshop and hopefully, you'd be positively reinforced and motivate to learn further on your own!

Keep 7-9th May free - because we sure hope you are looking forward to joining us as much as we are to meet you! For any questions that you may have, definitely do not hesitate to contact us.