[postgis-users] bug in bbox containment operators

David Blasby dblasby at refractions.net
Fri Feb 6 09:23:30 PST 2004


Greg Janée wrote:
> 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);
...
> 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:


 From the documentation:

A @ B
The "@" operator returns true if A's bounding box is completely 
contained by B's bounding box.

A ~ B
The "~" operator returns true if A's bounding box completely contains 
B's bounding box.


So, A @ B implies B ~ A, which is what you're seeing.


dave




More information about the postgis-users mailing list