[Qgis-developer] QGIS QgsVectorFileWriter

Bjorn Nyberg bjorn.burr.nyberg at gmail.com
Tue Jul 30 19:57:47 PDT 2013


I have a list of Linestrings [(x,y),(x,y)] pairs that i've created as

    shapelist.append(([QgsPoint(x1,y1),QgsPoint(x2,y2)]))


shapelist[:5]
[[(4.11658e+06,5.18318e+06), (4.11717e+06,5.18218e+06)], [(4.11847e+06,5.18323e+06), (4.11771e+06,5.18223e+06)], [(4.1064e+06,5.17508e+06), (4.10647e+06,5.17408e+06)], [(4.10755e+06,5.1749e+06), (4.10693e+06,5.1739e+06)], [(4.11138e+06,5.15935e+06), (4.112e+06,5.15835e+06)]]


MultiPolyLine = QgsGeometry.fromMultiPolyline(shapelist)

However when I attempt to apply the writer by 

writer = QgsVectorFileWriter(out, "CP1250", fields, QGis.WKBMultiLineString, layer.crs(), "ESRI Shapefile")

I receive the following traceback:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: arguments did not match any overloaded call:
  QgsVectorFileWriter(QString, QString, QgsFields, QGis.WkbType, QgsCoordinateReferenceSystem, QString driverName="ESRI Shapefile", QStringList datasourceOptions=QStringList(), QStringList layerOptions=QStringList(), QString newFilename=None): argument 3 has unexpected type 'dict'
  QgsVectorFileWriter(QgsVectorFileWriter): argument 1 has unexpected type 'str'


What does a Qstring imply here? Do I need to apply PyQt4.QtCore.QString(out)? 

Cheers,
Bjorn 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130731/2b029a15/attachment.html>


More information about the Qgis-developer mailing list