This project has moved and is read-only. For the latest updates, please go here.

Shapefile save using v0.9

Topics: SharpMap v0.9 / v1.x, WinForms Controls
Dec 15, 2008 at 12:40 PM
Hi all,

What is the best approach to save a shapefile using v0.9.

I've seen other discussions but found nothing working in relation to v0.9.
Ogr is something i'd like to skip.

Do i use NetTopologySuite and if so, does anyone have a code-example.



Dec 16, 2008 at 8:32 PM
NetTopologySuite for v0.9 uses GeoTool's ShapeFileWriter. Using it is pretty straighforward.

            IPoint p1 = Factory.CreatePoint(new Coordinate(100, 100));
            IPoint p2 = Factory.CreatePoint(new Coordinate(200, 200));

            GeometryCollection coll = new GeometryCollection(new IGeometry[] { p1, p2, });
            ShapefileWriter writer = new ShapefileWriter(Factory);
            writer.Write(@"c:\test_arcview", coll);

            ShapefileWriter.WriteDummyDbf(@"c:\test_arcview.dbf", 2);

Dec 16, 2008 at 9:06 PM
Thanks for the example.

Will do some testing. I have featuredata, so a little investigation here is due :)