Hi,
I am using the QGis python console for the use of exporting an active layer 
from postgist to a shape file layer.  I want to include the symbology as is 
possible through the GUI of QGis 2 (Dufour).
I am using the 
writeAsVectorFormat<http://www.qgis.org/api/classQgsVectorFileWriter.html#a289af78b5b609fbcb0572aaf505f2822>
 method of the QgsVectorFileWriter class, but keep getting the message that 
there are "Too many arguments" as if the parameter doesn´t exist. That seems 
correct given the fact that the mouse popup for the parameters doesn't indicate 
a Symbology parameter. However in the  official QGis API the parameter is 
mentioned: 
http://www.qgis.org/api/classQgsVectorFileWriter.html#a1aac90d30d811d2888d1aab4098ad63c.
 The symbology parameter seems tob e added in the latest release (QGis 2)
Am I using it the wrong way or is someting else going on?
The alternative would be save the style als SLD and import the style file after 
creating the shape layer, but if I can avoid that ...
The console code sofar:
canvas = iface.mapCanvas()
aLayer = iface.activeLayer()
if aLayer.dataProvider().name() == 'postgres':
    writer =  QgsVectorFileWriter
    error = writer.writeAsVectorFormat(aLayer, 
r"D:\Documenten_Travelingo\SkyDrive Pro\Horeca routes\Projectbestanden\deBaak 
Driebergen\Shape bronnen\\"+ aLayer.name() + ".shp", "CP1250", None, "ESRI 
Shapefile", False, None,"","", False, None, "NoSymbology", 1.0)
#    then import the shape file in a new layer
if error == QgsVectorFileWriter.NoError:
    vlayer = QgsVectorLayer(r"D:\Documenten_Travelingo\SkyDrive Pro\Horeca 
routes\Projectbestanden\deBaak Driebergen\Shape bronnen", aLayer.name() + 
".shp", "ogr")
    QgsMapLayerRegistry.instance().addMapLayer(vlayer)
Th error is raised at the writeAsVectorFormat method and its parameter 
NoSymbology.
Thanx in advance
Kinds regards,
Pim Verver

_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to