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

Extract lat/long coordinates from a shapefile

Topics: SharpMap Project, General Topics
Apr 21, 2007 at 9:10 AM
Hi, is it possible to extract lat/long coordinates from a shapefile?
Apr 23, 2007 at 4:40 AM
i got the problem but not in this way , i need to point a lat,lon with a icon on the map
Apr 23, 2007 at 3:23 PM
Assuming you have a point shapefile, this is how you can dump out the x & y of each feature:

ShapeFile shapeFile = new ShapeFile("path_to_my_file");
FeatureDataRow feature;
Point pnt;
for (uint i = 0; i < shapeFile.GetFeatureCount(); ++i)
  feature = shapeFile.GetFeature(i);
  pnt = (Point)feature.Geometry;
  Console.Write("x={0}, y={1}", pnt.X, pnt.Y);

Abe Gillespie,
Programmer for hire - GIS, Business Apps, Website Apps
Apr 24, 2007 at 3:44 PM
Ok, thanks! I'll try.
Jun 2, 2007 at 3:36 AM
you could extract shp file data to a database with this method. Nice.