Eric,
I don't think this is a bug in Shapely -- it's because of an invalid
Polygon. GeoDjango's error handler outputs the GEOS error message to
stderr:
>>> from django.contrib.gis.geos import fromstr
>>> g1 = fromstr('POLYGON (( ... ))')
>>> g2 = fromstr('POLYGON (( ... ))')
>>> g1.equals(g2)
GEOS_ERROR: TopologyException: side location conflict 0.5 0.5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jbronn/django/trunk/django/contrib/gis/geos/base.py",
line 313, in equals
return geos_equals(self.ptr, other.ptr)
File
"/Users/jbronn/django/trunk/django/contrib/gis/geos/prototypes/errcheck.py",
line 48, in check_predicate
raise GEOSException('Error encountered on GEOS C predicate function
"%s".' % func.__name__)
django.contrib.gis.geos.error.GEOSException: Error encountered on GEOS C
predicate function "GEOSEquals".
>>>
You're missing a (0, 1) coordinate so the ring goes outside the bounds
of the shell.
Regards,
-Justin
Eric Lemoine wrote:
> Hello
>
> I stumbled accross an issue with Shapely. See the following test case:
>
>>>> from shapely import wkt
>>>> g1 = wkt.loads('POLYGON ((0.0000000000000000 0.0000000000000000,
>>>> 1.0000000000000000 1.0000000000000000, 1.0000000000000000
>>>> 0.0000000000000000, 0.0000000000000000 0.0000000000000000),
>>>> (0.5000000000000000 0.5000000000000000, 0.7000000000000000
>>>> 0.7000000000000000, 0.7000000000000000 0.5000000000000000,
>>>> 0.5000000000000000 0.5000000000000000))')
>>>> g2 = wkt.loads('POLYGON ((0.0000000000000000 0.0000000000000000,
>>>> 1.0000000000000000 1.0000000000000000, 1.0000000000000000
>>>> 0.0000000000000000, 0.0000000000000000 0.0000000000000000),
>>>> (0.5000000000000000 0.5000000000000000, 0.7000000000000000
>>>> 0.7000000000000000, 0.7000000000000000 0.5000000000000000,
>>>> 0.5000000000000000 0.5000000000000000))')
>>>> g1.equals(g2)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/home/eric/public_html/mapfish/env/lib/python2.5/site-packages/Shapely-1.0.11-py2.5.egg/shapely/predicates.py",
> line 34, in __call__
> return bool(self.fn(self.context._geom, other._geom))
> File
> "/home/eric/public_html/mapfish/env/lib/python2.5/site-packages/Shapely-1.0.11-py2.5.egg/shapely/predicates.py",
> line 21, in errcheck
> raise PredicateError, "Failed to evaluate %s" % repr(self.fn)
> shapely.geos.PredicateError: Failed to evaluate <_FuncPtr object at
> 0xb7c285dc>
>
> Any idea?
>
> --
> Eric
> _______________________________________________
> Community mailing list
> [email protected]
> http://lists.gispython.org/mailman/listinfo/community
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community