[Qgis-user] How can I reset the starting point of a QgsFeatureIterator?

Stefano Masera stefano.masera at arpa.piemonte.it
Mon Oct 21 06:44:11 PDT 2013


Hi list, 
I use an iterator two times in a python code and I have to reset it to the starting point before to recall it. 


# first use of the iterator 
iterator = layer.dataProvider().getFeatures() 

for feature in iterator: 
# operations 

# than, a second time I have to use the operator, in a following part of the code: 

for feature in iterator: 
# other operations 


But it doesn't start from the first feature! 



I try with: 
iterator.rewind() 
between the two blocks, but it doesn't work. 


Thanks. 





Stefano Masera 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20131021/25389363/attachment.html>


More information about the Qgis-user mailing list