[geos-devel] Binary Predicate Bug - Even Worse!

Todd Jellett todd.jellett at caris.com
Tue Jun 12 11:05:58 EDT 2007


It turns out that this is also the case for identical geometries!

If you take just GeomA and run all the listed binary predicates (below) 
against itself, you get exactly the same as below.

Running GeomA->GeomA I get:
Disjoint    False
Equal       True
Touch      False
Contain    True
Within      True
Overlap    False

Running a simple geometry against itself should return True for Equals 
*only*. It is ambiguous to be also contained and within.

Todd

Todd Jellett wrote:
> 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
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel



More information about the geos-devel mailing list