Run, edit, document and store a setting model in QGis 2.8

Run a model

The model can be run in two ways:

  • from the graphic modeller window, or
  • from the Box processing tools panel

To run a model from the graphic modeller window, click the button Launch themodel:

 To run a model from the setting toolbox panel, firstly save and close the model. Then, find the model by accessing setting|Toolbox|Models, right click on the model to be run and select perform in the context menu.

 In our example, the model is in the OysterCadastre group.
The model dialog box opens with the information fields for the entries defined in its design.

 In order to input the data layers , you can choose the data loaded in QGIS by using the drop-down arrow, or you using the Browse button ([…]) to locate the data in the disk .

 When you use the drop-down arrow, the window depicts the loaded layers corresponding to the defined type at the model entry. In order to enter plots we have pointed out that the vector layer had to be a polygons layer. Therefore, the window depicts the two polygon type layers that are actually loaded: the plots and the land.

In the  Installations type entry, we have indicated a point vector type layer. The window displays the only layer of this type currently charged. Distance , has, by default, a value of 500m as defined in the model .

For the output, you can choose to create a temporary or definitive layer. In the first case, you leave the field empty. The shape is created in the user temporary repertoire, and will be cleared with the remaining contents by closing the QGis session. In the second case, you enter a path and file name for the resultant layer.

The box to be checked is Open the file Output after running the model loaded in the resulting mapping layer window, if it is checked .

Click RUN to run the model .
The dialog box will switch towards the Log tab, which provides an output during the execution . The result appears in the following figure:

The plots and land areas in red correspond to a distance of 500 m from the oysters’ establishments.

How to edit a model

The existing models in QGIS can be modified as needed. A right click on a model in the processing toolbox panel opens a context menu. Edit model opens the model in the modeller graphic window. The model can also be deleted by right clicking on Delete model.

If a model is opened in the graph modeller window, you have, of course, the same possible editing entries for the model: by clicking on the pencil icon for a model entry, you will open the parameter definition dialog and you will have the chance to make the desired changes; by clicking the button (X) you will remove the entry of the model. Regarding the algorithms, the information about the algorithm parameters can be displayed by clicking 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.

 A right click on an algorithm opens a context menu, as you can see in the following screenshot.

 By clicking Remove you delete the algorithm of the model if there is no other algorithm that depends 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 will have to be deleted before you can remove this algorithm.

By clicking Edit in the algorithm contextual menu, you open the algorithm dialogue window. Therefore, you can enter your changes.

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

By clicking Deactivate ( disable ) in the algorithm context menu you disable the algorithm as well as all the downstream algorithms that depend on this algorithm . An algorithm can be reactivated at any time by right clicking and choosing Activate ( activate ). By cons, if the deactivation of the downstream algorithms is done automatically , you will activate each algorithm individually .

How to document a model

Warning: The update of the update file does not work for versions 2.8, 2.8.1 and 2.8.2. A bug makes that all edits with the publisher help be lost. Usually, the following QGis update should have this problem resolved. You can inquire a model help by clicking the Help model editor button in the graphic modeller window.

 This will open the Help Editor window that has three panels. At the top is an HTML page with spaces reserved for the description of the algorithm, and sections for the input and output parameters. In the lower left corner, you have an elements selection box, and in the right bottom corner input text box. To edit an item, select the left window, and then use the right box to enter a descriptive text. Click OK when you have finished.
This information help will then be available in the Help tab when the tool is in run mode.

 

How to save, load, and export models The models can be saved at any time by clicking the Save button in the setting modeller window.

Do not hesitate to save your job regularly… As we have mentioned in the modeller configuration, the first time you record a model, you will be asked to name the model file. For updates, they will be automatically done for the recorded file unless you want to change the name of your model file. In this case, you will use the Save As button

 The models that are not recorded in the default folder of the models can be opened in two ways:
• By activating the Box processing tools panel, navigating Models|Tools, and then double-clicking Add model from file
• By using the graphic modeller window and clicking OpenModel.

 

In both cases, you must select .Model file. The models can also be exported as image files. This is useful if the workflow needs to be presented and included in a report.
To export a model, click the ExportAsPicture button .

 The model will be saved as a PNG file.

 

Scripts collection Currently, QGIS counts with an online collection of models and scripts that can to be loaded. In the panel of the setting toolbox, navigate to Models|Tools and double-click Get models from the collection of scripts online.

The new models will be loaded in the Models section of the panel under the group Models example.

 

This collection of online models will be constantly expanded by QGIS users.

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 *