[QGIS-Developer] QgsFeatureRequest SortByOrder

Jorge Almerio jorgealmerio at yahoo.com.br
Fri Jun 1 09:15:56 PDT 2018


Can anyone help me how to iterate through features using a Field as a sort order?

 

I saw that there is a function  <https://qgis.org/api/classQgsFeatureRequest.html#ad9c11d4c88185fcfb0a54f8703699717> setOrderBy on QgsFeatureRequest, by it seems to request a OrderBy Class argument, but I could not get how to use it.

 

Simple example:

"

lyr = iface.activeLayer()

prov = lyr.dataProvider()

for feature in prov.getFeatures(QgsFeatureRequest()):

    print feature.id()

"

 

Thank you

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180601/90d15c74/attachment.html>


More information about the QGIS-Developer mailing list