How to determine if a geographic point is inside a polygon?

10 views (last 30 days)
Base Matlab offers inpolygon function but it uses planar coordinates which makes it tricky to use in geographic applications. I get that I can still use it, but I will always be forced to think about things like sufficient point density along the polygon perimeter, date line crossings, poles, etc. I also can use intrplat if I need to properly increase the point density of my polygon taking great circle distances into account, but I'm wondering if there's an easier way.
Mapping toolbox while offering geopoint and geoshape objects, as well as multitude of tools for working with polygons, does not seem to provide a way to easily identify geopoints which lie inside a polygon or geoshape.
Or am I missing something?

Answers (1)

darova
darova on 5 Mar 2021
Can you project the point on the polygon? Then you can use only (x,y) (inpolygon) to detect if the point is inside
  2 Comments
Anton Gromov
Anton Gromov on 5 Mar 2021
The problem is not that the point is not in the plane, but there is no plane at all since all the polygons are on a sphere of the Earth. And we need to deal with spherical geometry here.
Sergey Kostrukov
Sergey Kostrukov on 14 Nov 2021
It's unfortunate that Mapping Toolbox doesn't provide much beyond file reading and plotting.

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!