Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question

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.
           Min distance to polygon

share|improve this answer
+1 for answering question... Can these be achieved using PHP? – Rajeev Vyas Jan 2 '13 at 12:41
Of course, Yes, assuming you mean the php scripting language. It is singularly inappropriate for this type of computation, but one could do it. I would instead use a language more oriented toward numerical computation. – Joseph O'Rourke Jan 3 '13 at 0:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.