[postgis-users] bug in bbox containment operators

Greg Janée gjanee at alexandria.ucsb.edu
Fri Feb 6 08:38:15 PST 2004


The bounding box containment operators (@, ~) give spurious results.   
I'm not sure if this is a PostGIS bug or a bug in PostgreSQL itself.   
PostgreSQL 7.4, PostGIS 0.8.1, Solaris 8.  Thanks, -Greg

gazsearch2=# select * from i_feature_footprint where footprint @  
GeometryFromText('POLYGON((-120 30,-119 30,-119 31,-120 31,-120  
30))',54001);
   feature_id | footprint
------------ 
+----------------------------------------------------------------------- 
------------------------------------------------------------------------ 
-----------------------------------------------------
         3328 | SRID=54001;POLYGON((-180 -56,-180 85,180 85,180 -56,-180  
-56))
          125 | SRID=54001;POLYGON((-180 23.2099990844727,-180 71,180  
71,180 23.2099990844727,-180 23.2099990844727))
          156 | SRID=54001;POLYGON((-177.100006103516  
13.710000038147,-177.100006103516 76.629997253418,-61.4799995422363  
76.629997253418,-61.4799995422363 13.710000038147,-177.100006103516  
13.710000038147))
      6225435 | SRID=54001;POLYGON((-119.378890991211  
28.6783294677734,-119.378890991211 38.6619415283203,-119.36222076416  
38.6619415283203,-119.36222076416 28.6783294677734,-119.378890991211  
28.6783294677734))
(4 rows)

Writing the query the other way around, i.e.,

gazsearch2=# select * from i_feature_footprint where  
GeometryFromText('POLYGON((-120 30,-119 30,-119 31,-120 31,-120  
30))',54001) ~ footprint;

gives the exact same results.  Here's the table:

gazsearch2=# \d i_feature_footprint
Table "public.i_feature_footprint"
    Column   |   Type   | Modifiers
------------+----------+-----------
  feature_id | integer  | not null
  footprint  | geometry |
Indexes:
     "i_feature_footprint_pkey" primary key, btree (feature_id)
     "gis_index_footprint" gist (footprint)
Check constraints:
     "$1" CHECK (srid(footprint) = 54001)




More information about the postgis-users mailing list