In the Documentation for QgsFeature

http://qgis.org/api/2.14/classQgsFeature.html

It lists two methods for accessing the attributes

QVariant     attribute (const QString &name) const
QVariant     attribute (int fieldIdx) const

If I use the first method it works fine (ie feature.attribute('City')) ,
but the second (ie feature.attribute(0)) fails with the message

QgsFeature.attribute(QString): argument 1 has unexpected type 'int'

If instead I just use an index such as

feature[fieldIdx]

where feature is a QgsFeature, it works fine.

Am I missing something here or is the second 'attribute' method invalid?

Thanks,

Calvin
_______________________________________________
Qgis-developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to