ShapeFile creation

Topics: Data Access, SharpMap v2.0
Aug 20, 2007 at 6:22 PM
Hi all,

is possible to create ShapeFile in SharpMap?


Aug 20, 2007 at 11:20 PM
Yes, in v2.0 it is possible to create and write to a ShapeFile.

You can look in the unit tests which cover the ShapeFile provider - SharpMap.Tests/Providers/ShapeFileTests.cs - to get a good idea of how to do it. Here's a direct link.

It's basically like this (with schema):
FeatureDataTable schema = new FeatureDataTable();
schema.Columns.AddRange( new DataColumn[] {
	new DataColumn("Name", typeof(String)),
	new DataColumn("Date_Created", typeof(DateTime)),
	new DataColumn("Visits", typeof(int)),
	new DataColumn("Weight", typeof(float))
ShapeFile shapeFile = ShapeFile.Create("UnitTestData", "Test1", ShapeType.Point, schema);
Aug 21, 2007 at 7:34 AM
Thanks, great!

I've downloaded source code from google, but I cannot use it together with SharpMap.UI from CodePlex. Is somewhere new version of SharpMap.UI? (I'm using it for developing desktop application.)


Aug 21, 2007 at 4:38 PM
SharpMap.UI is a project from the v1.0 incarnation of SharpMap. Due to the need to rework the UI to accomodate decoupled rendering, the UI project has been refactored. The desktop UI bits are in SharpMap.Presentation.WinForms project for v2.0.

That said, this part of the code is being worked on right now, since the model-view-presenter pattern was just worked out and is now being implemented. Expect much roughness and change in that project over the next few weeks. In fact, it's even on a different branch: