[Qgis-developer] attributeMap()
Martin Dobias
wonder.sk at gmail.com
Sat Feb 2 08:33:05 PST 2013
Hi Francesco
On Sat, Feb 2, 2013 at 4:24 PM, francescoboccacci at libero.it
<francescoboccacci at libero.it> wrote:
> i have some problem to adapt my old code to new API.
> i have below piece of code:
>
> index = vproviderA.fieldNameIndex(field)
> atMap = inFeat.attributeMap()
> idVar = atMap[ index ]
>
> to get a value of a this features in a field.
> Now is it no possbile because QgsFeature hasn't attributeMap().
attributeMap() has been replaced by attributes(), but there's
additionally an easier way how to access attributes by indices:
>>> idVar = inFeat[0]
And now there is even easier way for accessing attributes - directly
by field name:
>>> idVar = inFeat["name"]
Martin
More information about the Qgis-developer
mailing list