[postgis-users] ST_Intersects on geography

Kidd, David M d.kidd at imperial.ac.uk
Tue Apr 19 02:22:05 PDT 2011


Thanks for the response, especially as it was truncated by an accidental premature send.

I have solved my immediate problem by casting to geometry.

It is, however, worrrying that such fundamental errors exist in in the geography functions,as for example,

SELECT ST_Intersects('POINT(-160 -43)'::geography, 'POLYGON((-170 -80, -170 0, 170 0, 170 -80, -170 -80))'::geography)
also returns FALSE, which is not a query on the outer fringe.

Incidently, the same query using && also gives an incorrect result.

SELECT 'POINT(-160 -43)'::geography && 'POLYGON((-170 -80, -170 0, 170 0, 170 -80, -170 -80))'::geography

BTW I'm using PostGIS1.5.

I - Dave


David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470



________________________________
From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paragon Corporation
Sent: 18 April 2011 17:17
To: 'PostGIS Users Discussion'
Subject: Re: [postgis-users] ST_Intersects on geography

Hmm I didn't realize we use BOOM! in our errors, but I guess we do since I get the same message in 2.0 and 1.5. :)

I know there are issues with the outer fringes when you get into the -180 ... area which we have bug tickets in place for and patches not yet applied.  That could be one of them
try moving in a bit like 179.5 89 etc.

Unfortunately the guy who deals with these things is incognito at the moment
________________________________
From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Kidd, David M
Sent: Monday, April 18, 2011 10:25 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] ST_Intersects on geography

Hi,

Applogies if the is a stupid newbie question.

I have am writing some some simple point in polygon searches on geographic data using ST_Intersects, but have been getting some unexpected results;

Searching for a point in the southern hemisphere:

SELECT ST_Intersects('POINT(-160 -43)'::geography, 'POLYGON((-180 -90, -180 0, 180 0, 180 -90, -180 -90))'::geography)

Returns f

Searching for a point in the northern hemisphere:

SELECT ST_Intersects('POINT(160 43)'::geography, 'POLYGON((0 0, 0 90, 180 90, 180 0, 0 0))'::geography)

ERROR:  BOOM! Could not generate outside point!
CONTEXT:  SQL function "st_intersects" statement 1

********** Error **********

ERROR: BOOM! Could not generate outside point!
SQL state: XX000
Context: SQL function "st_intersects" statement 1
This works though






David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110419/c1645f3e/attachment.html>


More information about the postgis-users mailing list