Does it mean that, when I get a geometry collection, the very first thing I have to do is to split it into simple/multiple but homogeneous geometries to go on ?<br><br>In the script I've posted, I could have use "contains" or "within" with the two polygons instead of "equals" with the intersection, but in others cases, I'm afraid it is not so easy/simple !<br>
<br>Can you give me an advice ?<br><br>Pascal<br><br><div class="gmail_quote">2009/3/16 Sean Gillies <span dir="ltr"><<a href="mailto:sgillies@frii.com">sgillies@frii.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The GEOS C API returns a integer value of 2 to indicate an error. It's good to learn that geometry collection predicates aren't supported.<div><div></div><div class="h5"><br>
<br>
On Mar 16, 2009, at 9:46 AM, Martin Davis wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
GEOS does not support evaluating predicates on GEOMETRYCOLLECTIONS (due to the potential complexity and lack of obvious semantics of heterogeneous collections).<br>
<br>
In JTS trying to do this throws an exception. I'm not sure how GEOS reacts - or possibly shapely is not handling this gracefully?<br>
<br>
Pascal Leroux wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all<br>
<br>
while searching for intersections between polygons (buildings), I have found shapes that make "equals" predicate crash. With simpler shapes, it occurs too :<br>
<br>
>>> from shapely.geometry import Polygon<br>
>>> p1 = Polygon(((0,0),(0,10),(10,10),(10,0),(8,0),(8,8),(2,8),(2,0)))<br>
>>> p2 = Polygon(((2,0),(2,8),(8,8),(7,4),(8,0)))<br>
>>> inter = p1.intersection(p2)<br>
>>> inter.is_valid and p1.is_valid and p2.is_valid<br>
True<br>
>>> inter.wkt<br>
'GEOMETRYCOLLECTION (POINT (8.0000000000000000 0.0000000000000000), LINESTRING (8.0000000000000000 8.0000000000000000, 2.0000000000000000 8.0000000000000000), LINESTRING (2.0000000000000000 8.0000000000000000, 2.0000000000000000 0.0000000000000000))'<br>
>>> inter.equals(p1)<br>
False<br>
>>> inter.equals(p2)<br>
Traceback (most recent call last):<br>
File "<stdin>", line 1, in <module><br>
File "/usr/lib/python2.5/site-packages/Shapely-1.0.11-py2.5.egg/shapely/predicates.py", line 34, in __call__<br>
return bool(self.fn(self.context._geom, other._geom))<br>
File "/usr/lib/python2.5/site-packages/Shapely-1.0.11-py2.5.egg/shapely/predicates.py", line 21, in errcheck<br>
raise PredicateError, "Failed to evaluate %s" % repr(self.fn)<br>
shapely.geos.PredicateError: Failed to evaluate <_FuncPtr object at 0x96a3bf4><br>
<br>
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).<br>
<br>
Any idea ? Did I miss something ?<br>
<br>
Pascal<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
geos-devel mailing list<br>
<a href="mailto:geos-devel@lists.osgeo.org" target="_blank">geos-devel@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
</blockquote>
<br>
-- <br>
Martin Davis<br>
Senior Technical Architect<br>
Refractions Research, Inc.<br>
(250) 383-3022<br>
<br>
_______________________________________________<br>
geos-devel mailing list<br>
<a href="mailto:geos-devel@lists.osgeo.org" target="_blank">geos-devel@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
</blockquote>
<br>
_______________________________________________<br>
geos-devel mailing list<br>
<a href="mailto:geos-devel@lists.osgeo.org" target="_blank">geos-devel@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
</div></div></blockquote></div><br>