[postgis-tickets] [PostGIS] #2675: ST_Intersects() in WHERE clause misses results

PostGIS trac at osgeo.org
Wed Mar 12 11:24:49 PDT 2014


#2675: ST_Intersects() in WHERE clause misses results
---------------------+------------------------------------------------------
 Reporter:  xowap    |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.1.2
Component:  postgis  |     Version:  trunk        
 Keywords:           |  
---------------------+------------------------------------------------------
 As explained in this [http://gis.stackexchange.com/questions/88835/st-
 intersects-in-where-clause-misses-results stackexchange] question, I get
 inaccurate results when doing a ST_Intersects.

 To summarize how to reproduce the issue described in the question, here is
 a small SQL script

 {{{
 CREATE TABLE "demo" (
     "id" serial NOT NULL PRIMARY KEY,
     "geom" geography(GEOMETRYCOLLECTION,4326),
     "poly" geography(POLYGON,4326),
     "point" geography(POINT,4326)
 );

 INSERT INTO "demo" ("geom", "poly", "point") VALUES
 ('GEOMETRYCOLLECTION(POLYGON((39.95 70.05,40.05 70.05,40.05 69.95,39.95
 69.95,39.95 70.05)))'::geography, 'POLYGON((39.95 70.05,40.05 70.05,40.05
 69.95,39.95 69.95,39.95 70.05))'::geography, NULL),
 ('GEOMETRYCOLLECTION(POINT(40.0045845585 70.0036813508))'::geography,
 NULL, 'POINT(40.0045845585 70.0036813508)'::geography);

 -- Does not work
 SELECT id, ST_AsText(geom) FROM demo WHERE ST_Intersects(geom,
 'GEOMETRYCOLLECTION(POLYGON((39.95 70.05,40.05 70.05,40.05 69.95,39.95
 69.95,39.95 70.05)))'::geography);
 -- Works
 SELECT id, ST_AsText(geom) FROM demo WHERE ST_Intersects(geom,
 'POLYGON((39.95 70.05,40.05 70.05,40.05 69.95,39.95 69.95,39.95
 70.05))'::geography);
 -- Works
 SELECT id, ST_AsText(geom) FROM demo WHERE ST_Intersects("point",
 'GEOMETRYCOLLECTION(POLYGON((39.95 70.05,40.05 70.05,40.05 69.95,39.95
 69.95,39.95 70.05)))'::geography);
 }}}

 As indicated in the comments, I have built PostGIS from branches/2.1 at
 revision 12308.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2675>
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-tickets mailing list