I am using GeoDjango with PostGIS and am trying to use a polygon to get records from a database that fall inside it.
If I define a polygon that is more than half the area of โโthe earth, it assumes that the โinsideโ of my polygon is the smaller area that I intended to โoutsideโ and returns only results that are outside of it.
I can use this smaller, irregular area to exclude results. Polygon.area seems to know what I intend, so I can use this to determine when to make my search on or exclusive. I feel this problem is probably common, is there a better way to solve it?
Update: If 180 degrees longitude is inside my polygon, this does not work at all. GEOS seems to be to blame this time. This image shows what I consider the reason. Green is the polygon that I define, Red is how it interprets it.
Again, this seems like a problem that often arises and one of those with libraries like GEOS related to. Is there any way?
source share