I'm sorry, that doesn't work anymore...
<div id="result_box" dir="ltr">My file is not even created !</div>
<div dir="ltr"> </div>
<div dir="ltr">Thank you for your quick reply</div><br>
<div class="gmail_quote">2008/5/29 Vassilis Perantzakis <<a href="mailto:vaspervnp@yahoo.gr">vaspervnp@yahoo.gr</a>>:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">If it works like in Delphi, after creating the file you should close it with<br><br>shpFile.SHPClose(newShp);<br>
<br>and then reopen it with<br><br>IntPtr newShp = shpFile.SHPOpen(@"\SD-MMCard\TestParcelle\ARRETBUS.shp ",<br>"rb+")<br><br>to insure appending mode. I believe the same goes for the dbf file.<br><br>
Let me know if it helped.<br><br>-----Original Message-----<br>From: <a href="mailto:shapelib-bounces@lists.maptools.org">shapelib-bounces@lists.maptools.org</a><br>[mailto:<a href="mailto:shapelib-bounces@lists.maptools.org">shapelib-bounces@lists.maptools.org</a>] On Behalf Of thecrashteam<br>
Sent: Thursday, May 29, 2008 6:31 PM<br>To: <a href="mailto:shapelib@lists.maptools.org">shapelib@lists.maptools.org</a><br>Subject: [Shapelib] Adding new shape to shapefile<br><br><br>Hello,<br><br><br><br>First, sorry for my English, I'll promise you I'll do my best.<br>
<br><br><br>I'm in a training period in order to prepare my degree and I've in charge of<br>the development of a PPC application in C# using shapelib.<br><br>I read some posts in this forum about adding shapes in shapefile, and I<br>
apply some parts of code in my application but, I have a problem with the<br>SHPWriteObject function. The application runs correctly but nothing is<br>written in my shapefile. Someone could help me ? Do I make a mistake in my<br>
code ?<br><br><br><br>Well thank you for your help<br><br><br><br>Romain<br><br><br><br><br><br>My code :<br><br>IntPtr newShp = shpFile.SHPCreate(@"\SD-MMCard\TestParcelle\ARRETBUS.shp",<br>ShapeFile.ShapeFile.ShapeType.Point);<br>
<br>double[] dblX = new double[1];<br><br>dblX[0] = 803606;<br><br>double[] dblY = new double[1];<br><br>dblY[0] = 800000;<br><br>IntPtr newDbf = shpFile.DBFCreate(@"\SD-MMCard\TestParcelle\ARRETBUS.dbf");<br><br>
IntPtr pso = shpFile.SHPCreateObject(ShapeFile.ShapeFile.ShapeType.Point, 1,<br>1, null, null, 1, dblX, dblY, null, null);<br><br>IntPtr psObject =<br>shpFile.SHPCreateSimpleObject(ShapeFile.ShapeFile.ShapeType.Point, 1, dblX,<br>
dblY, null);<br><br>shpFile.SHPWriteObject(newShp, -1, psObject);<br><br>shpFile.SHPWriteObject(newShp, -1, pso);<br><br>shpFile.DBFClose(newDbf);<br><br>shpFile.SHPClose(newShp);<br>--<br>View this message in context:<br>
<a href="http://www.nabble.com/Adding-new-shape-to-shapefile-tp17536792p17536792.html" target="_blank">http://www.nabble.com/Adding-new-shape-to-shapefile-tp17536792p17536792.html</a><br>Sent from the ShapeLib mailing list archive at Nabble.com.<br>
<br><br>_______________________________________________<br>Shapelib mailing list<br><a href="mailto:Shapelib@lists.maptools.org">Shapelib@lists.maptools.org</a><br><a href="http://lists.maptools.org/mailman/listinfo/shapelib" target="_blank">http://lists.maptools.org/mailman/listinfo/shapelib</a><br>
<br>_______________________________________________<br>Shapelib mailing list<br><a href="mailto:Shapelib@lists.maptools.org">Shapelib@lists.maptools.org</a><br><a href="http://lists.maptools.org/mailman/listinfo/shapelib" target="_blank">http://lists.maptools.org/mailman/listinfo/shapelib</a><br>
</blockquote></div><br>