Greetings Devs,
I have a large number of shapefiles I need to process and have had limited 
success using QGis 2.0.1 with it's python console.
// This works - 
from osgeo import ogr

canvas =
qgis.utils.iface.mapCanvas()

allLayers = canvas.layers()

for i in allLayers: i.selectAll(); print i.name(); print
i.selectedFeatureCount()
// What I can't figure out is how to throw in a selection and then run Dissove 
on it.
I've tried 
for i in allLayers: i.selectAll(); print i.name(); 
i.getFeatures(QgsFeatureRequest().QgsExpression('LWFLAG <> "P" '); print 
i.selectedFeatureCount()andselExp = QgsExpression('LWFLAG <> "P" ')for i in 
allLayers: i.selectAll(); print i.name(); 
i.getFeatures(QgsFeatureRequest(selExp); print i.selectedFeatureCount()
andfor i in allLayers: i.selectAll(); print i.name(); 
i.getFeatures(QgsFeatureRequest('LWFLAG <> "P" ')); print 
i.selectedFeatureCount()
and several other techniques all to no avail. 
In PseudoCode:
from osgeo import ogrcanvas = qgis.utils.iface.mapCanvas()allLayers = 
canvas.layers()for i in allLayers:       i.select('LWFLAG <> "P" ');       
print i.name();       print i.selectedFeatureCount();      i.dissolve("use 
sel", i.name() + '_dis', "BLOCKGRP");
                                          
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to