Basically I have set of points [lat-long pairs] which defines different polygons on map. Now I have a coordinate [lat-long] from which I want to find the nearest polygon from that point.
Any help would be appreciated.
Thanks.
|
Basically I have set of points [lat-long pairs] which defines different polygons on map. Now I have a coordinate [lat-long] from which I want to find the nearest polygon from that point. Any help would be appreciated. Thanks. |
||||
|
|
|
There are two approaches. One is brute-force: write code to find the distance between a point and a polygon, and then iterate over all polygons. The second involves building efficient data structures, an arduous process. For the first approach, you might look at this Wolfram Demonstration Project for computing the distance from a point to a polygon. Link here; image below. Note that sometimes the min distance is achieved at a point interior to an edge of the polygon.
|
|||||
|