I have a series of coordinates which forms a MKPolygon. I have another coordinate say user location. Now I need to find the nearest point from the user location to the polygon to show the shortest distance from the user location to polygon. In my observations, there is no direct way to achieve this. Could some one help me find a solution for this in swift for iOS?
Asked
Active
Viewed 460 times
1
-
One possible way to do this is you may find the distance between two coordinates (Reference: https://developer.apple.com/documentation/corelocation/cllocation/1423689-distance?changes=_4) and then find the smallest distance. – Sunil Chauhan Jun 18 '19 at 17:28
-
@SunilChauhan I need all coordinates of the polygon for this. I only have a polygon which was created with edge coordinates. – prabhu Jun 18 '19 at 17:31
-
Oh, okay. This is not written in swift, but you will get the gist: https://stackoverflow.com/a/19048284/1208191 – Sunil Chauhan Jun 18 '19 at 17:37