This project is read-only.

Help creating shapefile getting to many lines

Mar 23, 2012 at 3:11 PM

Hi I need a little help.

*When i run the following code i get 8000 rows instead og 4000

the output is:

Id, ProductType, Fido


1,, 2


2, another, 4

How to avoid all the null lines?

            Feature f = new Feature();
            FeatureSet fs = new FeatureSet(f.FeatureType);
            ProjectionInfo dest = default(ProjectionInfo);
            dest = KnownCoordinateSystems.Geographic.World.WGS1984;
            fs.Projection = dest;

            int i = 0;

            fs.DataTable.Columns.Add(new DataColumn("ID", typeof(int)));
            fs.DataTable.Columns.Add(new DataColumn("ProductTypeName", typeof(string)));            
            foreach (var item in x)
                DotSpatial.Topology.Point p = new DotSpatial.Topology.Point();
                p.X = Convert.ToDouble(item.xLatWgs84, CultureInfo.InvariantCulture);
                p.Y = Convert.ToDouble(item.yLonWgs84, CultureInfo.InvariantCulture);
                DotSpatial.Data.IFeature currentFeature =  fs.AddFeature(p);                              
            fs.SaveAs("point.shp", true);

Mar 26, 2012 at 1:51 PM

I believe it should suffice to replace line:



currentFeature.DataRow["ID"] = i;
currentFeature.DataRow["ProductTypeName"] = item.ProductTypeName;