[postgis-devel] [PostGIS] #1976: ST_Intersects() returns false while ST_Intersection returns a geography

PostGIS trac at osgeo.org
Wed Sep 5 11:18:59 PDT 2012


#1976: ST_Intersects() returns false while ST_Intersection returns a geography
-----------------------+----------------------------------------------------
 Reporter:  mhiper3pg  |       Owner:  pramsey      
     Type:  defect     |      Status:  new          
 Priority:  medium     |   Milestone:  PostGIS 1.5.6
Component:  postgis    |     Version:  1.5.X        
 Keywords:             |  
-----------------------+----------------------------------------------------
 When running ST_Intersects() with multipolygons, sometimes ST_Intersects()
 returns false for the intersection, while ST_Intersection() returns a
 geography (not empty).

 How to reproduce: loading the geography for the state of Iowa (attached)
 in a table (with no indexes), and querying for the intersection with a
 polygon fully contained in the state:


 {{{
 select st_intersects(geog, ST_GeographyFromText('SRID=4326;POLYGON((-95.9
 42.9,-95.9 43,-95.8 43,-95.8 42.9,-95.9 42.9))')),
 st_astext(st_intersection(geog,ST_GeographyFromText('SRID=4326;POLYGON((-95.9
 42.9,-95.9 43,-95.8 43,-95.8 42.9,-95.9 42.9))'))) from states where
 name10='Iowa'
 }}}

 yields this result:


 {{{
  st_intersects |
 st_astext
 ---------------+-------------------------------------------------------------------------------------------------------------------------------
  f             | POLYGON((-95.9 42.8999999999999,-95.9
 42.9999999999999,-95.8 42.9999999999999,-95.8 42.8999999999999,-95.9
 42.8999999999999))
 (1 row)

 }}}

 So, the query with ST_Intersects() returns false (which is wrong), but
 using ST_Intersection() provides the correct result.

 Is this behavior normal?

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1976>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list