is there is any method to find a shortest distance between points. i.e there is a point A and collection of feature(points) now i want to find shortest distance (not route) between the A and the collection's point. and it return the point (from collection) which is at the shortest distance to point A
You are use GetShortestLineTo Method, compare the distance from A to any of the point in the collection B, then return the shortest one. like: PointShape pointA = new PointShape(); PointShape pointB = new PointShape(); Collection<PointShape> collectionB = new Collection<PointShape>(); collectionB.Add(pointB); PointShape shortestPoint; foreach (PointShape point in collectionB) { point.GetShortestLineTo(pointA, GeographyUnit.DecimalDegree); //compare and assign to shortestPoint } return shortestPoint
Or if the points in the collection can make a lineshape. you can use GetShortestLineTo with the lineshape directly.