I have vectors of lat/lon and want to find points that fall within an 8-point quadrant from a source point.
Was attempting to use inpolygon but couldn't figure out how to create the compass triangles based on a starting location. The quadrants are +- 22.5 degrees from the 8 cardinal points [0-360,45,90,135,180,225,270,315].
Therefore, if a point is northeast of the origin it would lie within a boundary 22.5 and 67.5. As i found out, you can't just simply subtract those values from the origin lat and lon. Any help would be great.
in = inpolygon(lat,lon,[src_lat,x_lim(1),x_lim(1)],[src_lon, src_lon+src_lon*.225, src_lon-src_lon*.225]);
Below is a sample lat/lon pair. Assume my start point is lat = 31.56, lon = 91.39.
30.433 -91.759 29.761 -90.3 29.181 -92.199 33.065 -92.344 32.923 -90.332 32.906 -94.435 30.481 -93.619 28.779 -93.766 28.496 -92.399 29.584 -91.312 31.557 -93.136 34.089 -89.848 33.121 -89.231 32.418 -90.307 29.384 -90.569 29.517 -92.767 33.018 -93.567 31.584 -92.277 30.551 -90.219 32.844 -91.866 30.675 -90.202 29.538 -89.232 29.514 -89.553 32.335 -92.06 32.331 -90.235 29.598 -91.418 33.126 -90.745 33.766 -89.968 32.497 -90.36 31.199 -88.882
Best Answer