[Qgis-developer] featureAtId replacement

Jürgen E. Fischer jef at norbit.de
Mon Feb 11 08:23:20 PST 2013


Hi Denis,

On Mon, 11. Feb 2013 at 15:20:54 +0100, Denis Rouzaud wrote:
> 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?

I'd write:

f = QgsFeature()
if layer.getFeatures( QgsFeatureRequest().setFilterFid( self.subset[i] ) ).nextFeature( f ):
  return f


Jürgen

-- 
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-31
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de
committ(ed|ing) to Quantum GIS                         IRC: jef on FreeNode                         

-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502



More information about the Qgis-developer mailing list