Outdated version of the documentation. Find the latest one here.

18.25. Mais execução interativa de algoritmos

Nota

This lesson shows how to combine the iterative execution of algorithms with the modeler to get more automation.

The iterative execution of algorithms is available not just for built-in algorithms, but also for the algorithms that you can create yourself, such as models. We are going to see how to combine a model and the iterative execution of algorithms, so we can obtain more complex results with ease.

The data the we are going to use for this lesson is the same one that we already used for the last one. In this case, instead of just clipping the DEM with each watershed polygon, we will add some extra steps and calculate a hypsometric curve for each of them, to study how elevation is distributed within the watershed.

Since we have a workflow that involves several steps (clipping + computing the hypsometric curve), we should go to the modeler and create the corresponding model for that workflow.

You can find the model already created in the data folder for this lesson, but it would be good if you first try to create it yourself. The clipped layer is not a final result in this case, since we are just interested in the curves, so this model will not generated any layers, but just a table with the curve data.

O modelo deve ser semelhante a este:

../../../_images/model1.png

Adicione o modelo de pasta da modelos, para que esteja disponível na caixa de ferramentas, e agora execute-o.

../../../_images/model1.png

Select the DEM and watersheds basins, and do not forget to toggle the button that indicates that the algorithm has to be run iteratively.

O algoritmo será executado várias vezes, e as tabelas correspondentes serão criadas e abertas no seu projeto QGIS.

../../../_images/tables.png

We can make this example more complex by extending the model and computing some slope statistics. Add the Slope, aspect, curvature algorithm to the model, and then the Raster statistics algorithm, which should use the slope output as its only input.

../../../_images/model2.png

If you now run the model, apart from the tables you will get a set of pages with statistics. These pages will be available in the results dialog.