[Shapelib] Adding new shape to shapefile

thecrashteam didier.romain at gmail.com
Mon Jun 16 07:13:42 PDT 2008


Hi Christian,

As you said, I change the path for my create function (I have created a
folder on the system root) but my file are still created on th system root
(even if I have a file named "test" in my folder), so it is not a problem
with the SD card. I already have problem with the filename which is still
empty.
I continue my research and if I have something new, I'll post it here.

Best regards

Romain.

[code]
string chemin = @"\testEditShapefile\test";

//création du dbf
IntPtr ptrDBFCreate = shpFile.DBFCreate(chemin);


//nouvelle colonne dans le dbf
shpFile.DBFAddField(ptrDBFCreate, chemin,
ShapeFile.ShapeFile.DBFFieldType.FTString, 255, 0);

//écriture de la valeur liée au futur shape
shpFile.DBFWriteStringAttribute(ptrDBFCreate,
shpFile.DBFGetRecordCount(ptrDBFCreate), 0, "ça marche  ?");

shpFile.DBFClose(ptrDBFCreate);

//création du point
double[] x = new double[1];
double[] y = new double[1];
double[] z = new double[1];
x[0] = 803606;
y[0] = 803606;
z[0] = 0;

IntPtr psObject =
shpFile.SHPCreateSimpleObject(ShapeFile.ShapeFile.ShapeType.Point, 1, x, y,
z);

//création du shapefile
IntPtr ptrSHPCreate = shpFile.SHPCreate(chemin,
ShapeFile.ShapeFile.ShapeType.Point);

//écriture du point dans le shape
shpFile.SHPWriteObject(ptrSHPCreate, -1, psObject);
//fermeture du dbf et du shapefile
shpFile.SHPClose(ptrSHPCreate);
[/code]
-- 
View this message in context: http://www.nabble.com/Adding-new-shape-to-shapefile-tp17536792p17859034.html
Sent from the ShapeLib mailing list archive at Nabble.com.





More information about the Shapelib mailing list