# [geos-devel] Binary Predicate Bug

Todd Jellett todd.jellett at caris.com
Tue Jun 12 10:02:59 EDT 2007

```Hi all,

First question I'd like to ask is "Are the binary predicates supposed to
be mutually exclusive?". For any 2 geometries, is there only one binary
predicate that is a member of (disjoint, equal, touches, contains,
within, overlaps) that can be true and all the others must be false?
Note I am leaving out intersects because it is a special case of the
other predicates. It is not the same type of spatial relation as
contains/within.

If this is so, I'd like to report a bug. Given the 2 simple single ring
polygons:

GeomA = POLYGON((0.0 0.0), (5.0 0.0), (5.0 5.0), (0.0 5.0), (0.0 0.0))
and
GeomB = POLYGON((5.0 5.0), (0.0 5.0), (0.0 0.0), (5.0 0.0), (5.0 5.0))

Note that these are essentially the same ring, just starting at a
different position on the ring.

Running all of the above predicates (disjoint, equal, touches, contains,
within and overlaps) for both GeomA->GeomB and GeomB->GeomA I get:

GeomA->GeomB
Disjoint   False
Equal      True
Touch     False
Contain   True
Within     True
Overlap   False

GeomB->GeomA
Disjoint   False
Equal      True
Touch     False
Contain   True
Within     True
Overlap   False

As you can see, all 3 of (equals, contains, and within) come back as True.

Shouldn't this just be an equal?
How can 2 simple geometries be equal *and* contained *and* within? This
does not make sense.

Although these geometries are simple, I suspect this behavior holds for
all geometries that are "equivalent" but just start/end on a different
point.

I'm testing with v3.0.0 rc4

Todd

```