[postgis-users] polygons crossing 0/360 longitude

Shane Byrne shane at quake.mit.edu
Tue Jun 20 15:52:11 PDT 2006


Hi,
I have a postgres/postgis database with many (~80k) polygons, the 
vertices of which are stored in longitude (0-360) and latitude space. 
These polygons are typically small, but a few hundred of them span the 
prime meridian. This creates a problem for me when I search for polygon 
intersections. i.e. a polygon with a longitude range -5 to +5 is 
actually stored as +355 to +5 and so postgis thinks it intersects a 
whole bunch of polygons that it really doesn't.  I could change to the 
-180 to 180 longitude system but that only moves the problem to a 
different longitude.

Is there a graceful way around this?
I'm thinking of just making two tables, the other table would have 
longitudes ranging from -180 to +180 and doing two searches with 
longitude ranges chosen to avoid the problem area on each table. Does 
postgis have a way to handle cyclical coordinates?

Thanks for any help,
Shane





More information about the postgis-users mailing list