[Qgis-developer] R: Re: attributeMap()
Martin Dobias
wonder.sk at gmail.com
Mon Feb 4 01:06:05 PST 2013
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