[Shapelib] Adding new shape to shapefile
vaspervnp at yahoo.gr
Thu May 29 11:53:24 EDT 2008
If it works like in Delphi, after creating the file you should close it with
and then reopen it with
IntPtr newShp = shpFile.SHPOpen(@"\SD-MMCard\TestParcelle\ARRETBUS.shp ",
to insure appending mode. I believe the same goes for the dbf file.
Let me know if it helped.
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
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
Well thank you for your help
My code :
IntPtr newShp = shpFile.SHPCreate(@"\SD-MMCard\TestParcelle\ARRETBUS.shp",
double dblX = new double;
dblX = 803606;
double dblY = new double;
dblY = 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,
shpFile.SHPWriteObject(newShp, -1, psObject);
shpFile.SHPWriteObject(newShp, -1, pso);
View this message in context:
Sent from the ShapeLib mailing list archive at Nabble.com.
Shapelib mailing list
Shapelib at lists.maptools.org
More information about the Shapelib