[Qgis-developer] Looping over features in processing

Tim Sutton tim at qgis.org
Fri Jul 24 12:22:09 PDT 2015


Hi

> On 24 Jul 2015, at 20:06, Paolo Cavallini <cavallini at faunalia.it> wrote:
> 

Ah thanks, got it now. Any idea how I can write the output layers out with e.g.

<feature_name>_roads.shp
<feature_name>_buildings.shp

(I’m basically trying to iteratively loop through wards, clipping out all the roads and buildings for each ward to a file named on the ward name).

Also being able to put the date into the name would be great. 

Regards

Tim

> Just click on the small green arrow besides layer name.
> Cheers.
> 
> Il 24 luglio 2015 18:40:33 CEST, Tim Sutton <tim at qgis.org> ha scritto:
> Hi
> 
>> On 23 Jul 2015, at 22:44, Tim Sutton <tim at qgis.org <mailto:tim at qgis.org>> wrote:
>> 
>> Hi Victor
>> 
>>> On 23 Jul 2015, at 22:18, Victor Olaya <volayaf at gmail.com <mailto:volayaf at gmail.com>> wrote:
>>> 
>>> Tim
>>> 
>>> What you are describing is the behaviour of the iterative execution of algorithms (for a layer with n features, it runs the algorihtm n times, each of them using as input a layer with only one of those features). That can be executed without the need to code anything, from the algorithm dialog.
>>> 
>> 
>> Yeah that sounds exactly like what I am after. I will go and take a look at that.
> 
> 
> Sorry to be a bit slow here - I went back to try this and couldn’t see where / how to do it - can you give a few more pointers?
> 
> Thanks!
> 
> Regards
> 
> Tim
> 
>> 
>> Thanks!
>> 
>> Regards
>> 
>> Tim
>> 
>>> If it's not exactly what you are looking for and you want to code something similar, maybe you can at least check the corresponding code to get some ideas
>>> 
>>> https://github.com/qgis/QGIS/blob/master/python/plugins/processing/gui/AlgorithmExecutor.py#L58 <https://github.com/qgis/QGIS/blob/master/python/plugins/processing/gui/AlgorithmExecutor.py#L58>
>>> 
>>> Let me know if you have more questions
>>> 
>>> Cheers
>>> 
>>> 
>>> 
>>> 2015-07-23 20:15 GMT+02:00 Tim Sutton <tim at qgis.org <mailto:tim at qgis.org>>:
>>> Hi all
>>> 
>>> Is it possible to write loops in processing. I’d like to do stuff like iterate over each poly in a polygon layer, clip features from a few layers and write them to a subfolder whose name is based on the name of the polygon layer. Think of it like atlas but for data not for print compositions. Has anyone done something similar?
>>> 
>>> Regards
>>> 
>>> Tim
>>> 
>>> 
>>> <PastedGraphic-1.tiff>
>>> 
>>> 
>>> Tim Sutton
>>> QGIS Project Steering Committee Member
>>> tim at qgis.org <mailto:tim at qgis.org>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>>> 
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>> <PastedGraphic-1.tiff>
>> 
>> 
>> Tim Sutton
>> QGIS Project Steering Committee Member
>> tim at qgis.org <mailto:tim at qgis.org>
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
> 
> 
> 
> Tim Sutton
> QGIS Project Steering Committee Member
> tim at qgis.org <mailto:tim at qgis.org>
> 
> 
> 
> 
> 
> 
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
> -- 
> Paolo Cavallini
> http://www.faunalia.eu <http://www.faunalia.eu/>_______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer




Tim Sutton
QGIS Project Steering Committee Member
tim at qgis.org




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150724/74e46827/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.tiff
Type: image/tiff
Size: 9882 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150724/74e46827/attachment-0001.tiff>


More information about the Qgis-developer mailing list