[postgis-users] Problem with the overlap operator && (?)

Gregory S. Williamson gsw at globexplorer.com
Tue Nov 14 20:40:07 PST 2006

```Rob,

Without examples of the data involved, it's hard to say for sure, but offhand perhaps the && operator, which uses bounding boxes only, does find that the 2nd object's BB overlaps the first object's BB, but the stricter (and slower, non-index using, "overlaps" function) is correctly seeing that they do not really overlap. Think of a "C" shape with a much smaller circle in the open area in the middle ... or a shape that has a long diagonal, so the bounding box embraces a large are compared to the actual area of the shape.

If you can reduce this to a simple case and show the geometries I am sure that smarter heads than mine could chime in.

HTH

Greg Williamson
DBA
GlobeXplorer LLC

-----Original Message-----
From:	postgis-users-bounces at postgis.refractions.net on behalf of Rob Tester
Sent:	Tue 11/14/2006 8:21 PM
To:	postgis-users at postgis.refractions.net
Cc:
Subject:	[postgis-users] Problem with the overlap operator && (?)

I recently (with my install of 1.1.5) have run into something that is
puzzling me about the overlaps operator. I have two tables that I am
comparing the geometry objects using the following SQL:

select overlaps(a.wkb_geometry,b.wkb_geometry),a.primaryKey,b.primaryKey
from az_cr9 a,az_kz b where a.primaryKey=2203 and b.primaryKey=293546 and
a.wkb_geometry&&b.wkb_geometry

This returns one row:

f;2203;293546

My question is how does the overlaps operator return TRUE and the overlaps
function return FALSE. In fact the two geometries in question do not close
to each other. Is this operator broken?

This query returns no rows as expected:

select
overlaps(a.wkb_geometry,b.wkb_geometry),a.cr_id,b.ogc_fid,b.blockgroupid,
b.blockid
from az_carrierroute9 a,az_kz_calculated_test b where a.ogc_fid=2203 and
b.ogc_fid=293546 and overlaps(a.wkb_geometry,b.wkb_geometry)

Any help on this?

Rob

-------------------------------------------------------
Click link below if it is SPAM gsw at globexplorer.com
"https://mailscanner.globexplorer.com/dspam/dspam.cgi?signatureID=455a9686171332117817174&user=gsw@globexplorer.com&retrain=spam&template=history&history_page=1"
!DSPAM:455a9686171332117817174!
-------------------------------------------------------

```