I have an array of co-ordinates (List A) from a polyline. I have one of the co-ordinate (B) from a polyline which is located around the array of co-ordinates of the other polyline (List A).
I want to detect the co-ordinate in List A which is closest to co-ordinate (B).
Known co-ordinates would be,
1. Array of co-ordinates
2. the reference co-ordinate.
Can anyone help ?
If what wou need is to get the nearest vertex, you could loop through all vertex and get the lowest value of:
Math.Pow(vertex.X - coordinate.X, 2) + Math.Pow(vertex.Y - coordinate.Y, 2)
The lowest value indicates the nearest vertex.
But if you need the nearest point to the polyline, you could use the "GetClosestPointTo" method of the polyline.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register