<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sorry martin, I made a mistake in my previous question: it is "new
points" and not "new lines" I want to add<br>
Let me explain my problem with more precision..<br>
<br>
I scan a directory containing csv files. Each file contains several
data. One of the data is "date".<br>
I would like to write a single shapefile for each date encountered
during my processing..<br>
That is why I would like to know how to open an existing shapefile
(with data on it)&nbsp; in writing mode, and then append the new data from
the csv file.<br>
<br>
Example :<br>
A shapefile called 071212.shp exists.<br>
My script open a csv file with the date "071212" --&gt; I want to add
the data of this csv file to 071212.shp<br>
If I use :<br>
writer = QgsVectorFileWriter("071212.shp"), "CP1250", fields,
QGis.WKBPoint, None)<br>
it doesn't do anything.<br>
<br>
In an short way "Is it possible to open a shapefile in write mode and
then append some new data at the end" ?<br>
<br>
Thanks a lot<br>
Michael<br>
<br>
<br>
<br>
Martin Dobias a &eacute;crit&nbsp;:
<blockquote
 cite="mid:e8e7199c0712120822n6eeb47b4of03807a0c77c3e9f@mail.gmail.com"
 type="cite">
  <pre wrap="">On Dec 12, 2007 4:48 PM, Micha&euml;l Douchin <a class="moz-txt-link-rfc2396E" href="mailto:michael.douchin@laposte.net">&lt;michael.douchin@laposte.net&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi all,
After a re-reading of Martin's page :
<a class="moz-txt-link-freetext" href="http://wiki.qgis.org/qgiswiki/PythonBindings#head-1a654755a57432eb139ca1344f35379e404ec10b">http://wiki.qgis.org/qgiswiki/PythonBindings#head-1a654755a57432eb139ca1344f35379e404ec10b</a>
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 ?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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


  </pre>
</blockquote>
</body>
</html>