This project has moved. For the latest updates, please go here.

Reading Shapefile

Topics: General Topics
Oct 9, 2006 at 5:22 PM

I am trying to read the information out of a shapefile. I want to draw the map myself, so I need a list of the lines in the shape file. Can anyone please tell me how to get this.

Thank You
Oct 10, 2006 at 9:37 PM

Just initiate a datasource, which is a shape file in your case
and then retrieve all features.

            SharpMap.Data.Providers.ShapeFile shp = new SharpMap.Data.Providers.ShapeFile(@"f:\area.shp");
            Collection<uint> GeomIds = new Collection<uint>();
            GeomIds = shp.GetObjectIDsInView(myShapeLayer.DataSource.GetExtents());
            SharpMap.Data.FeatureDataRow fdr;
            foreach(uint id in GeomIds)
            	fdr = shp.GetFeature(id);
Oct 15, 2006 at 6:26 PM
thank you.

i have now wrote my own reader, but thank you anyways.