GPS Points in Polygon – Detecting if GPS Coordinates Fall Within Polygon of Points

latitude longitudepointpoint-in-polygonpoint-of-interestpolygon

I'm looking for a simple explanation on how to detect if GPS coordinates fall within a polygon of points.

I would prefer an explanations that can be done using paper and pencil and not programming language specific.

If I have a list of points (latitude and longitude in degrees) that makes up a polygon. How can I tell if a point falls withing that polygon.

The only data I have access to is the polygon points and the point to check. An example is: 41.21,-104.77(point to check) then I have polygon points (39.39 -101.69 + 48.8335,-106.2435 + 38.803,-109.5781 + 39.4413,-111.043 + 45.6336,-113.7162 + 48.8335,-106.2435)

enter image description here

I found a Java specific answer and an R specific answer but I am looking for a programming language agnostic answer. Something written in plain English/step by step.

Best Answer

If you want a really simple algorithm how about this:

  • Take your point and draw a straight line to the bounding box of your polygon.
  • Count how many times it crosses the polygon boundary.
  • If number is odd it must be inside, if even it must be outside.
Related Question