Hi Martin, hi all,

Having a feature ID, I'd like to get the corresponding feature. Here is what I wrote in python:

        freq = QgsFeatureRequest()
        freq.setFilterFid(myID)
        features = []
        for f in layer.getFeatures( freq ):
            features.append( f )
        if len( features ) != 0:
           return features[0]

which quite heavier than the previous

f = QgsFeature
if layer.featureAtId(self.subset[i],f):
   return f


Is there anything I missed? Anything lighter to write?

Thanks a lot,

Denis




_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to