[Qgis-developer] R: Re: Re: Re: R: Re: attributeMap()

francescoboccacci at libero.it francescoboccacci at libero.it
Mon Feb 4 12:30:24 PST 2013


Hi Martin,
your code works fine. I used :

features = QGisLayers.features(vlayerA)
for inFeat in features:

from SEXTANTE module and it is not works properly.

so below code:


for inFeat in vproviderA.getFeatures():
       idVar = inFeat [ index ]

working fine.

Thanks

Francesco


>----Messaggio originale----
>Da: wonder.sk at gmail.com
>Data: 04/02/2013 10.06
>A: "francescoboccacci at libero.it"<francescoboccacci at libero.it>, "qgis-dev"
<qgis-developer at lists.osgeo.org>
>Ogg: Re: Re: Re: [Qgis-developer] R: Re: attributeMap()
>
>On Mon, Feb 4, 2013 at 9:20 AM, francescoboccacci at libero.it
><francescoboccacci at libero.it> wrote:
>> Hi Martin,
>> this is my code:
>>
>>            vproviderA = vlayerA.dataProvider()
>>
>>             allAttrsA = vproviderA.attributeIndexes() #vettore contente 
tutti
>> gli indici dei campi
>>
>>             try:
>>                 vproviderA.select(allAttrsA)
>>             except:
>>                 vproviderA.getFeatures()
>
>You cannot use getFeatures() like this: it returns a feature iterator
>which you need to use for accessing features - the state of iteration
>over features is not held there, not in the provider. This is the
>easiest way to use it:
>
>for feature in vproviderA.getFeatures():
>  type = feature["type"]
>  # do something with type
>
>Martin
>




More information about the Qgis-developer mailing list