[postgis-users] polygons crossing 0/360 longitude
Pritchard, MJ (Matt)
M.J.Pritchard at rl.ac.uk
Fri Aug 4 04:48:48 PDT 2006
Hi Shane (& Carlos),
Thanks for your posts about this: this is really helpful as I have been
grappling with this issue, too. However I'm still stuck...
Do you have an example of a spatial search query that works, Shane,
using geometries loaded using your lon_wrap() function?
The problem I have had is false hits caused by postgis incorrectly
assigning a bounding box to a geometry spanning the dateline, which then
spans the *rest* of the longitude range. E.g. if your geometry's
longitude range is 170 to -170, its resulting BB will be -170 to 170
(implying it crosses the Greenwich meridian, not the dateline), hence
the false positive if you search over Greenwich.
E.g. If you take a geometry like
'POLYGON(((-170 20,170 20,170 5,-170 5,-170 20)),-1'
(which spans the dateline)
And split it as per your method into
'MULTIPOLYGON(((360 20,360 5,190 5,190 20,360 20)),((0 5,0 20,170 20,170
5,0 5))),-1'
Then apply a search like
select * from matt_test where geom1 && geometryfromtext('POLYGON(( -10
10, 10 10, 10 5, -10 5, -10 10))',-1);
then I still get a false positive. AFAICT, the problem is present
whether your geometries are all in SRID=4326 or all in SRID=-1
Have you got some other method of searching that avoids this problem?
Many thanks,
Matt
-------------------------------------------
NERC Earth Observation Data Centre
Space Science & Technology Dept.
CCLRC Rutherford Appleton Laboratory
Chilton, Didcot OX11 0QX
01235 445645 (tel) / 445848 (fax)
http://www.neodc.rl.ac.uk/
More information about the postgis-users
mailing list