Hi everyone, I am using QGIS 1.9 Master in Ubuntu 12.10. I am trying to develop a plugin and need to extract data from attributes tables of the .shp.
I created a GUI for the user can Open shp from the computer and the code recognize the shp file and I can get the name of the .shp, name of columns, etc. but I can not get the values for each row and work with them. I follow the cookbook but when I type "provider.select(allAttrs)" the python console in QGIS says: "AttributeError:QgsVectorDataProvider' object has no attribute 'select' here is the code I used: (i didn't copy the definition of GUI because with that is any prolem) from PyQt4 import QtGui, QtCore from PyQt4 import * from qgis.core import * from PyQt4.QtCore import * from PyQt4.QtGui import * import qgis.utils, sys # supply path to where is your qgis installed QgsApplication.setPrefixPath("/usr/", True) #load providers QgsApplication.initQgis() ******* self.ln_lnk.setText(str(self.filename_lnk)) lnk_shp = QgsVectorLayer(self.filename_lnk, 'casires', 'ogr') if not lnk_shp.isValid(): print "doesnt work" QtGui.QMessageBox.Warning(self, "Warning", "shp not valid", QtGui.QMessageBox.Ok) try: provider = lnk_shp.dataProvider() feat = QgsFeature() allAttrs = provider.attributeIndexes() provider.select(allAttrs) attr_list =[] while provider.nextFeature(feat): attrs = feat.attributeMap() for(k,attr) in attrs.iteritems(): attr_list.append(attr.toString()) except: self.ln_save.setText("Falsch") I try the same plugin in a oldest version of QGIS 1.7.5 and it works or at least doesn't show this "Falsch". I am wondering during a week and have no idea to sole this. I would really apreciate if someone can solve this problem because is really important to create this plugin and for tha I need to take the data from the attribute table, if not I can not continuous anymore. Does anyone what is wrong and why my QGIS doesnt recognize the provider.select(allAttrs)? I would like to know if somebody knows how to install a oldest version of QGIS (e.g. 1.7.5)?? thank you so much!!
_______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer