[Shapelib] Adding new shape to shapefile

thecrashteam didier.romain at gmail.com
Thu May 29 08:31:10 PDT 2008


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.





More information about the Shapelib mailing list