[geos-devel] Bug in GEOSEquals predicate ?

Pascal Leroux pa.leroux at gmail.com
Sat Mar 14 05:06:17 EDT 2009

Hi all

while searching for intersections between polygons (buildings), I have found
shapes that make "equals" predicate crash. With simpler shapes, it occurs
too :

>>> from shapely.geometry import Polygon
>>> p1 = Polygon(((0,0),(0,10),(10,10),(10,0),(8,0),(8,8),(2,8),(2,0)))
>>> p2 = Polygon(((2,0),(2,8),(8,8),(7,4),(8,0)))
>>> inter = p1.intersection(p2)
>>> inter.is_valid and p1.is_valid and p2.is_valid
>>> inter.wkt
'GEOMETRYCOLLECTION (POINT (8.0000000000000000 0.0000000000000000),
LINESTRING (8.0000000000000000 8.0000000000000000, 2.0000000000000000
8.0000000000000000), LINESTRING (2.0000000000000000 8.0000000000000000,
2.0000000000000000 0.0000000000000000))'
>>> inter.equals(p1)
>>> inter.equals(p2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
line 34, in __call__
    return bool(self.fn(self.context._geom, other._geom))
line 21, in errcheck
    raise PredicateError, "Failed to evaluate %s" % repr(self.fn)
shapely.geos.PredicateError: Failed to evaluate <_FuncPtr object at

I have got a Bus Error on MacOSX (libgeos version 3.0.0) and a Segmentation
Fault on Ubuntu (libgeos version 3.0.3) with an equivalent code written in C
(so I think Shapely is not involved).

Any idea ? Did I miss something ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20090314/09a7f072/attachment.html

More information about the geos-devel mailing list