[Qgis-developer] vector writer : how to append new data to existing shapefile ?

Martin Dobias wonder.sk at gmail.com
Wed Dec 12 11:22:40 EST 2007


On Dec 12, 2007 4:48 PM, Michaël Douchin <michael.douchin at laposte.net> wrote:
> Hi all,
> After a re-reading of Martin's page :
> http://wiki.qgis.org/qgiswiki/PythonBindings#head-1a654755a57432eb139ca1344f35379e404ec10b
> I haven't find how to add new lines to an existing shapefile with the
> python bindings and the command :
>
> writer = QgsVectorFileWriter("my_shapes.shp", "CP1250", fields, QGis.WKBPoint, None)
>
> Is it possible yet ?

Hi,

yes, it is. The only changes you have to do:
- use QGis.WKBPolyline instead of QGis.WKBPoint when creating the
vector file writer
- assign geometry with type polyline to the features, e.g.:
fet.setGeometry(QgsGeometry.fromPolyline( [ QgsPoint(10,10),
QgsPoint(20,20) ] ))

Regards
Martin



More information about the Qgis-developer mailing list