[Shapelib] Adding new shape to shapefile

romain didier didier.romain at gmail.com
Thu May 29 12:00:04 EDT 2008


I'm sorry, that doesn't work anymore... My file is not even created !

Thank you for your quick reply

2008/5/29 Vassilis Perantzakis <vaspervnp at yahoo.gr>:

> If it works like in Delphi, after creating the file you should close it
> with
>
> shpFile.SHPClose(newShp);
>
> and then reopen it with
>
> IntPtr newShp = shpFile.SHPOpen(@"\SD-MMCard\TestParcelle\ARRETBUS.shp ",
> "rb+")
>
> to insure appending mode. I believe the same goes for the dbf file.
>
> Let me know if it helped.
>
> -----Original Message-----
> From: shapelib-bounces at lists.maptools.org
> [mailto:shapelib-bounces at lists.maptools.org] On Behalf Of thecrashteam
> Sent: Thursday, May 29, 2008 6:31 PM
> To: shapelib at lists.maptools.org
> Subject: [Shapelib] Adding new shape to shapefile
>
>
> Hello,
>
>
>
> First, sorry for my English, I'll promise you I'll do my best.
>
>
>
> I'm in a training period in order to prepare my degree and I've in charge
> of
> the development of a PPC application in C# using shapelib.
>
> I read some posts in this forum about adding shapes in shapefile, and I
> apply some parts of code in my application but, I have a problem with the
> SHPWriteObject function. The application runs correctly but nothing is
> written in my shapefile. Someone could help me ? Do I make a mistake in my
> code ?
>
>
>
> Well thank you for your help
>
>
>
> Romain
>
>
>
>
>
> My code :
>
> IntPtr newShp = shpFile.SHPCreate(@"\SD-MMCard\TestParcelle\ARRETBUS.shp",
> ShapeFile.ShapeFile.ShapeType.Point);
>
> double[] dblX = new double[1];
>
> dblX[0] = 803606;
>
> double[] dblY = new double[1];
>
> dblY[0] = 800000;
>
> IntPtr newDbf = shpFile.DBFCreate(@"\SD-MMCard\TestParcelle\ARRETBUS.dbf");
>
> IntPtr pso = shpFile.SHPCreateObject(ShapeFile.ShapeFile.ShapeType.Point,
> 1,
> 1, null, null, 1, dblX, dblY, null, null);
>
> IntPtr psObject =
> shpFile.SHPCreateSimpleObject(ShapeFile.ShapeFile.ShapeType.Point, 1, dblX,
> dblY, null);
>
> shpFile.SHPWriteObject(newShp, -1, psObject);
>
> shpFile.SHPWriteObject(newShp, -1, pso);
>
> shpFile.DBFClose(newDbf);
>
> shpFile.SHPClose(newShp);
> --
> View this message in context:
>
> http://www.nabble.com/Adding-new-shape-to-shapefile-tp17536792p17536792.html
> Sent from the ShapeLib mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Shapelib mailing list
> Shapelib at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/shapelib
>
> _______________________________________________
> Shapelib mailing list
> Shapelib at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/shapelib
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/shapelib/attachments/20080529/c64a0ffe/attachment.html


More information about the Shapelib mailing list