Graphical Model in Context

“Graphical Model is useful for automatic GIS task by providing workflows that link various processing tools and user input.”

An analysis in QGIS requires users running algorithms in a predetermined order. In some cases the sequence of steps are identical between different data sets and generating models which are generic can be useful to do repetitive tasks. In this module, we explore how to solve a real-world problem using the graphical model. We inherit the example from the previous exercise where we were running the steps manually.

You try:

Goal: To learn how to automate manual workflows using the Graphical Model

You are a city official and you have been instructed to investigate the effect of expanding OR Tambo Internation Airport by 50km. Use the geoprocessing tools (buffer, intersect, selection) to show how the expansion will affect the surrounding urban areas.

  • Load the layers from the exercise data.
  • Activate the processing toolbox.
  • Navigate to the section of models and create a new model.
    NB Since we have already done this exercise manually you need to remember the order of processes you did. Look at the exercise diagram for a hint.
  • Add your User Inputs as specified below
  • Navigate to the Algorithms tab and select the appropriate algorithms. Link them in the correct order. Do atomic changes to the model and test that it runs and produces the correct output.

Name Expectation

Inputs

Input Vector and Input Urban Areas

Geoprocessing Algorithms

Select by Attribute, Extract selected features, Buffer, Intersect , Dissolve

More about graphical model

The graphical model in QGIS consists of mainly two parts Inputs and Algorithms.

Object. Explanation Example
Inputs These are user-defined inputs required for running the algorithms Input vector layer or buffer distance
Algorithms Actual geoprocessing algorithm responsible for spatial analysis Buffer, intersection, Select by location etc

When analyzing a GIS problem it is important to visualize it first and determine the steps and order that you need to execute them. This will affect the final result if they are not executed in the correct way. When creating models in QGIS it is recommended to do it in a series of steps testing them along the way. The graphical model is also useful for running analysis where you are not concerned by the intermediary products but the final one. The model allows you to skip generating them but only focus on the end product.

When creating a model is it recommended to make the model generic as the saved model can also be used as an * Algorithm* for another process.
Your final output should look like the image below:

Check your knowledge:

  1. Which of the following statement regarding models is false:
    1. Models are only used for vector data.
    2. Model are useful for creating procedures which can be shared with users running QGIS
    3. In a model you can combine vector and raster algorithms
  2. After saving your model can you use it in another model as an algorithm:
    1. False
    2. True

Further reading:

Click here to download the sample data for the lesson.