Distance between vertexes on polyline?

Nov 25, 2012 at 4:36 PM
Edited Nov 25, 2012 at 4:45 PM


I read points of polyline and now I have to calculate length between these. My shape file has coordinate system: GCS_WGS_1984

Part of code get a coordinates:

case ShapeType.PolyLine:
ShapePolyLine shapePolyline = shape as ShapePolyLine;
foreach (PointD[] part in shapePolyline.Parts)
    Console.WriteLine("Polygon part:");
    foreach (PointD point in part)
        Console.WriteLine("{0}, {1}", point.X, point.Y);

Result from console:

Polygon part:
54,9130486119868, 55,2846051735019
56,3512399684539, 55,3104409463726
56,5320903785486, 54,7765016403788
55,8603602839112, 54,4492485173504

How Can I calculate distance (ex. km) between points? Can I use "Shapefile Reader" for this task?


Nov 27, 2012 at 3:56 AM

See http://en.wikipedia.org/wiki/Great-circle_distance for a lot of detail. The reader won't help you with this I'm afraid.