I have a point located inside a polygon, I want to determine its location or direction i.e. if it is in the northwest corner or southwest. I have the x,y of the point. Any idea on how to do this? I have the shape file of the point and polygon. Any help on this is most welcome.


You could do this by analyzing the point's position relative to the centroid of the polygon. If would just be a matter of calculating the angle between the two points and then testing that angle to determine which quadrant it runs towards/into. So for example, if the angle between two points is 45°, then it's running towards the northeast corner, if it's 135°, then it's the southeast.

You'll have to test the angle against ranges, not specific values, so angles between 0 and 90 would be northeast, 90-180 southeast, 180-270 southwest, 270-360 northwest.

Coding it all out and making it work are another matter entirely but conceptually I think this would accomplish what you're trying to do.

  • 1
    GBh does not describe the typical shape of these polygons. What happens if it is "bean shaped" for example? The centroid could fall outside but if a routine is used that forces a centroid to be inside the bean shaped polygon it could give a different answer. Just something to be aware of. – Hornbydd Sep 23 '13 at 23:33
  • If the point is always located inside of the polygon then the centroid could still be used pretty reliably I think. Even when the centroid falls outside of the polygon itself, the relationship between the contained point and the centroid could still identify which 'quadrant' the point is in. It really only becomes an issue in cases when the point falls outside of the polygon. – Kevin Sep 24 '13 at 15:47
  • Hello, Thanks for the reply, the point is always inside the polygon and the shape of polygons can be pentagon or hexagon, mostly they are rectangles and squares. – GBh Sep 24 '13 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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