Hi Raymond On Mon, Feb 14, 2011 at 11:27 AM, Raymond Nijssen <[email protected]> wrote: > Hi List, > > My python plugin changes attribute values in a table using this line: > > lyr.changeAttributeValue(feat.id(),fieldNum,result) > > It appears to take approximately 250 ms to run single this line of code. > That makes my plugin really slow in case I want to change a lot of values, > which is what I want. > > Does anyone know a faster way of doing this?
yes, there's a faster way. You can bypass the editing buffer in QgsVectorLayer and directly do the changes in underlying QgsVectorDataProvider - using its changeAttributeValues() method. In such way you can change many values at once more efficiently. Note: the changes you do to vector data provider are committed immediately to the data store (shapefile / database etc.) and cannot be undone. Regards Martin _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
