My problem is that I have a load of geographic point data (srid 4326) in a table. A user may do a bounding box search - essentially create a polygon as follows:
l_poly geography(Polygon,4326):= 'POLYGON((-120 -89, -120 81, 59.999 81, 59.999 -20, -120 -20))';
... then query using the ST_Intersect predicate
WHERE ST_Intersects(my_tab.point_data, l_poly)
In the above example, I can return a point at lon=0, lat=0. However, once my eastern-most longitude goes above 60 degrees (currently 59.999), then the longitudinal range exceeds 180 degrees, and my polygon wraps the opposite way around the earth. In this case I can not return data at 0 longitude, but I would at e.g. 180 longitude.
It seems as though a geographic polygon cannot be defined that exceeds a longitudinal extent of 180 degrees. Is this true? Can anyone point me in the direction of a solution?
I have tried casting a geography from a geometry defined with enforced Right Handedness, which I thought might define the interior of the polygon to the right hand side of a clockwise drawn polygon. But this doesn't work either.