Thanks for that - I wouldn't have known where to look. But this does the trick - although for my application I did have a need to explicitly convert the QString types to unicode. I looked at methods toAscii() and toLatin1() but neither produced the python string types I was expecting. Can you comment on that?
Many thanks again Ole On Wed, Dec 7, 2011 at 8:06 AM, Giuseppe Sucameli <[email protected]>wrote: > Hi Ole, > to get the field names you have to use the vector data provider. > > If vl contains the vector layer than: > > > provider = vl.dataProvider() # QgsVectorDataProvider > fields = provider.fields() # QMap<int, QgsField> > > ... # vl.select(), feat = QgsFeature(), while vl.nextFeature(feat): > > attrs = feat.attributeMap() > for (k,attr) in attrs.iteritems(): > name = fields[ k ].name() > print "%s: %s" % (name, attr.toString()) > > > Regards. > > -- > Giuseppe Sucameli >
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
