[Shapelib] Adding new shape to shapefile

thecrashteam didier.romain at gmail.com
Wed Jun 4 04:34:27 EDT 2008


Hi  Vassilis,


I tried what you told me too, but it still not work. No error, but no
files... It's hopeless !! ^^
I think there is something wrong against me with this library !!!

Thank you for your reply !

Romain

My code : 

//création du dbf
IntPtr ptrDBFCreate = shpFile.DBFCreate(@"\SD-MMCard\TestParcelle\test");

//création du shapefile
IntPtr ptrSHPCreate = shpFile.SHPCreate(@"\SD-MMCard\TestParcelle\test",
ShapeFile.ShapeFile.ShapeType.Point);

//nouvelle colonne dans le dbf
shpFile.DBFAddField(ptrDBFCreate, @"\SD-MMCard\TestParcelle\test",
ShapeFile.ShapeFile.DBFFieldType.FTString, 255, 0);

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

//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);

//écriture du point dans le shape
shpFile.SHPWriteObject(ptrSHPCreate, -1, psObject);

//fermeture du dbf et du shapefile
shpFile.SHPClose(ptrSHPCreate);
shpFile.DBFClose(ptrDBFCreate);
-- 
View this message in context: http://www.nabble.com/Adding-new-shape-to-shapefile-tp17536792p17641741.html
Sent from the ShapeLib mailing list archive at Nabble.com.




More information about the Shapelib mailing list