[Qgis-developer] Getting and setting attribute field names and values for vector layers

2011-12-06 Thread Ole Nielsen
Hi all I am a newcomer to Qgis plugins but not to Python and geoprocessing. Trying my hand at a plugin today I got pretty much to where I want to be in a very short time thanks to the excellent tutorials and logical design of the Python bindings. However, one issue threw me completely. The cookboo

Re: [Qgis-developer] Getting and setting attribute field names and values for vector layers

2011-12-06 Thread Giuseppe Sucameli
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 ... # vl.select(), feat = QgsFeature(), while vl.nextFeature(feat): attrs = feat.attribute

Re: [Qgis-developer] Getting and setting attribute field names and values for vector layers

2011-12-06 Thread Ole Nielsen
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 comme

Re: [Qgis-developer] Getting and setting attribute field names and values for vector layers

2011-12-07 Thread Alexander Bruy
Hi Ole, 2011/12/7 Ole Nielsen : > 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 >