I have a polygon presented by a series of longitude and latitude degrees. The longitude of this polygon is presented by degrees of [0 360] and it passes through the meridian. Also, I have two points and I need to check whether these points are located in this polygon.
For example, the longitude and latitude of this polygon is
PGlon = [5 5 355 355 5]; PGlat = [30 40 40 30 30];
and the points are
Xlon = [0 10]; Xlat = [35 45];
The positions of the polygon and points are as this figure (the first point is located inside this polygon).
I know that the function "inpolygon" may help to solve this problem, and I do
in_flag = inpolygon(Xlat,Xlon,PGlat,PGlon);
But this function cannot recognize whether the polygon crosses the meridian, so both points are identified to be outside the polygon.
Is there any useful way to handle this problem? Thanks!