[Qgis-developer] Fwd: How to Iterate with process.runalg()

Victor Olaya volayaf at gmail.com
Tue Jun 16 23:55:56 PDT 2015


There is no command to run and algorithm iteratively from the command line.
You can iterate creating yourself a loop and separating the features of the
input layer in the loop.

This method from the AlgorithmExecutor class might help you:

https://github.com/qgis/QGIS/blob/master/python/plugins/processing/gui/AlgorithmExecutor.py#L58

Hope this helps

Cheers



2015-06-16 20:45 GMT+02:00 Matt Wilkie <maphew at gmail.com>:

> *No bites on the qgis-user list, cross-posting to developers to fish for
> more help.*
>
>
> Hi folks,
>
> What is the python console syntax for the equivalent of pushing the
> "iterate over layers" processing button when using runalg() ? e.g.
> "p.runalg(... iterative=yes)".
>
> From "Additional functions for handling data" section in the training
> manual it likely has something to do with "getfeatures(layer)" but I'm not
> sure how to use these together.
>
> More at
> http://gis.stackexchange.com/questions/150703/interactive-for-each-item-in-do-in-qgis/151042#151042
>
> I tried to figure this out myself using the "Processing >> History and
> log" dialog, but that doesn't show any results when the Iterate button is
> depressed. In the following screen shot, the bottom two "INFO" entries are
> for an iterative processing operation, but they don't have corresponding
> "ALGORITHM" entries. While the topmost "INFO" corresponds to the one and
> only "ALGORITHM" entry, which wasn't iterative.
>
>
>>
> I'm using 32bit QGIS 2.8 on Windows (via Osgeo4w).
>
> best regards,
>
> Matt
>
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150617/8840b515/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2015-06-15 14_05_32-History and log.png
Type: image/png
Size: 26182 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150617/8840b515/attachment-0001.png>


More information about the Qgis-developer mailing list