Run and edit a processing model with QGis 2.8

Run a model

The model can be run in two ways:

  • from the graphical modeller
    window, or
  • from the Processing Toolbox panel .

To run a model from the Graphic Modeller window,
click the Launch Template button :

To
run a model from the Processing Toolbox panel, first save and close the model.
Then, find the model by accessing Processing |Toolbox |Models , right click on the model to run and select Run
in the context menu.

In
our example, the model is in the Ostrich Cadastre group .
The model dialog opens with the fields for entering the entries defined during
its design.  

In
order to enter the data layer, you can choose the data loaded into QGIS using
the drop-down arrow, or you can use the Browse button ([…]) to locate the
data on the disk

When
you use the drop-down arrow, the window displays the loaded layers
corresponding to the type defined in the model entry. For Parcels
entry we indicated that the vector layer should be a polygons layer. Thus, the window
displays the two polygon-type layers that are currently loaded: the parcels and
the land.   

In the Installations enter type, we have indicated a vector
layer point type. The window displays the only layer of this type currently
loaded. Distance has the default value of 500m set in the model.

As for the output, you can choose between creating a temporary layer or
a definitive layer. In the first case, you leave the field empty. The shape is
created in the temporary directory of the user and will be erased with the rest
of the content by closing the QGis session. In the second case, you enter a
path and file name for the resulting layer.

The Open Output File After Execution check box loads the
resulting layer into the map window, if it is checked.

Click on RUN to run the model.
The dialog will switch to the Log tab, which provides an output
during execution.

The result appears in the following figure:  

Plots and plot areas in red correspond to a distance of 500 m from the
oyster farms.

Edit a template

QGis existing models can be modified as needed. Right-clicking on a model
in the Processing Toolbox pane opens a pop-up menu. Edit Template
opens the model in the Graphic Modeller window. The model can also be deleted
here by clicking Delete Template .

If a model is opened in the graphical window of the modeller, you have,
of course, the same possibilities to edit the model’s entries as when it was
designed: by clicking on the pencil icon for a model entry you will open the
parameter definition dialog and you can make the desired changes; clicking the
(X) button will remove the model entry.

Regarding the algorithms, the information about
the parameters of the algorithm can be displayed by clicking on the +
signs located above and below an algorithm. This is a convenient way to see the
parameters of the algorithm without having to open each algorithm.

Right-clicking
an algorithm opens a context menu, as you can see in the following screenshot.  

By
clicking Remove you delete the algorithm from the model as long
as there are no other algorithms that depend on it.
If you try to delete an algorithm in the middle of a workflow, you will see the
following message:

The elements located downstream the algorithm must be deleted before
this algorithm can be removed.

By clicking on Edit in the contextual menu of the
algorithm, opens the dialogue window of the algorithm. You will be able to make
your changes.

After editing an algorithm, the connections to the other elements of the
model will be updated. The algorithm parameters displayed by clicking the +
sign above and below the algorithm will also be updated.

Clicking on Deactivate (disable) in the algorithm context
menu you disable the algorithm and all downstream algorithms that depend on
this algorithm. An algorithm can be reactivated at any time by right-clicking
on it and choosing Activate (activate). On the other hand, if the
deactivation of downstream algorithms is done automatically, you will have to
activate each algorithm individually.

Si cet article vous a intéressé et que vous pensez qu'il pourrait bénéficier à d'autres personnes, n'hésitez pas à le partager sur vos réseaux sociaux en utilisant les boutons ci-dessous. Votre partage est apprécié !

Leave a Reply

Your email address will not be published. Required fields are marked *