How to Write to a Shape (shp, dbf, shx) data

May 30, 2008 at 6:22 PM
I have some data in wkt and a block of features, how write this to a file(s)? I think with NTS but unknow how. Any Sugestion? NTS have a class 

IO.ShapefileDataWriter but unknow how use this).

regards

May 30, 2008 at 7:30 PM
Edited May 30, 2008 at 7:32 PM
Are you using v2? I did something similar by taking the latest trunk and modifying the ShapeFileProvider. I just needed to access to the features so I changed all the access modifiers from internal to public on the Dbase classes.

Then it was very easy to create the DbaseFile class, open the file and create a FeatureDataTable.

DbaseFile dbaseFile = new DbaseFile(fileName, null);
dbaseFile.Open(
true);

// Create a feature datatable based on the schema from the dbf file
FeatureDataTable<UInt32> table = dbaseFile.NewTable;

 

 

 

// Loop through all the records
for (uint i = 0; i < dbaseFile.RecordCount; i++)
{
    // Get the attributes
    FeatureDataRow<UInt32> dr = dbaseFile.GetAttributes(i, table);
}

 

 

Developer
May 30, 2008 at 8:48 PM


ojarana wrote:
I have some data in wkt and a block of features, how write this to a file(s)? I think with NTS but unknow how. Any Sugestion? NTS have a class 

IO.ShapefileDataWriter but unknow how use this).

regards



For NTS help, the best way to get support is to ask... in the right place:
http://groups.google.it/group/nettopologysuite
Jun 3, 2008 at 8:35 PM
Hi, I try to use v.2.0 of sharpmap, the dbf file is not complex but shp unknow how write my block of wkt to this file. The NTS site not have more info.

regards, but I wait for a litte sample.

Developer
Jun 4, 2008 at 7:27 AM


ojarana wrote:
Hi, I try to use v.2.0 of sharpmap, the dbf file is not complex but shp unknow how write my block of wkt to this file. The NTS site not have more info.

regards, but I wait for a litte sample.



If you ask in the right place, maybe you could get help...
Jun 12, 2008 at 9:29 PM
what are the best place to make this question? I stop my activities by this problem.
Coordinator
Jun 12, 2008 at 9:52 PM
There is a class which can write shape file binary in the SharpMap v2.0 repository, here:

http://code.google.com/p/sharpmapv2/source/browse/trunk/SharpMap.Data.Providers/ShapeFileProvider/ShapeFileProvider.cs