[Django] #25651: `GEOSException` during operations on some GeometryCollections

50 views
Skip to first unread message

Django

unread,
Oct 31, 2015, 7:51:16 AM10/31/15
to django-...@googlegroups.com
#25651: `GEOSException` during operations on some GeometryCollections
-------------------------------+--------------------
Reporter: sir-sigurd | Owner: nobody
Type: Uncategorized | Status: new
Component: GIS | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
{{{
In [16]: gc = GeometryCollection(GEOSGeometry('POLYGON((0 0, 0 4, 4 4, 4
0, 0 0))'), GEOSGeometry('POLYGON ((3 3, 3 4, 4 4, 4 3, 3 3))'))

In [17]: gc.union(gc)
GEOS_ERROR: TopologyException: side location conflict at 3 4

---------------------------------------------------------------------------
GEOSException Traceback (most recent call
last)
<ipython-input-17-9fc656c75d73> in <module>()
----> 1 gc.union(gc)

/home/sergey/dev/django/django/contrib/gis/geos/geometry.py in union(self,
other)
610 def union(self, other):
611 "Returns a Geometry representing all the points in this
Geometry and other."
--> 612 return self._topology(capi.geos_union(self.ptr,
other.ptr))
613
614 # #### Other Routines ####

/home/sergey/dev/django/django/contrib/gis/geos/libgeos.pyc in
__call__(self, *args, **kwargs)
155 if self.func is None:
156 self.func = self.get_func(*self.args, **self.kwargs)
--> 157 return self.func(*args, **kwargs)
158
159 def get_func(self, *args, **kwargs):

/home/sergey/dev/django/django/contrib/gis/geos/prototypes/threadsafe.pyc
in __call__(self, *args)
54 # Call the threaded GEOS routine with pointer of the
context handle
55 # as the first argument.
---> 56 return self.cfunc(self.thread_context.handle.ptr,
*args)
57 else:
58 return self.cfunc(*args)

/home/sergey/dev/django/django/contrib/gis/geos/prototypes/errcheck.pyc in
check_geom(result, func, cargs)
30 "Error checking on routines that return Geometries."
31 if not result:
---> 32 raise GEOSException('Error encountered checking Geometry
returned from GEOS C function "%s".' % func.__name__)
33 return result
34

GEOSException: Error encountered checking Geometry returned from GEOS C
function "GEOSUnion_r".
}}}

in psql
{{{
test_django=# SELECT ST_Union(ST_GeomFromText('GEOMETRYCOLLECTION (POLYGON
((0 0, 0 4, 4 4, 4 0, 0 0)), POLYGON ((3 3, 3 4, 4 4, 4 3, 3 3)))'),
ST_GeomFromText('GEOMETRYCOLLECTION (POLYGON ((0 0, 0 4, 4 4, 4 0, 0 0)),
POLYGON ((3 3, 3 4, 4 4, 4 3, 3 3)))'));
ОШИБКА: GEOSUnion: TopologyException: side location conflict at 3 4
}}}

As it reproducible in Postges, it appears this is a bug in GEOS, so I
[https://trac.osgeo.org/geos/ticket/752 reported] it, but if decide to
wrap it up in Django, I have an idea for this.

--
Ticket URL: <https://code.djangoproject.com/ticket/25651>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 31, 2015, 7:51:22 AM10/31/15
to django-...@googlegroups.com
#25651: `GEOSException` during operations on some GeometryCollections
-------------------------------+--------------------------------------
Reporter: sir-sigurd | Owner: sir-sigurd
Type: Uncategorized | Status: assigned
Component: GIS | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by sir-sigurd):

* status: new => assigned
* owner: nobody => sir-sigurd
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25651#comment:1>

Django

unread,
Oct 31, 2015, 9:04:45 AM10/31/15
to django-...@googlegroups.com
#25651: `GEOSException` during operations on some GeometryCollections
-------------------------------+--------------------------------------
Reporter: sir-sigurd | Owner: sir-sigurd
Type: Uncategorized | Status: assigned
Component: GIS | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by claudep):

Let's see your idea before accepting the ticket. Normally I would close it
as not related to Django. But if there is a not-to-hairy workaround, why
not...

--
Ticket URL: <https://code.djangoproject.com/ticket/25651#comment:2>

Django

unread,
Nov 1, 2015, 1:02:26 AM11/1/15
to django-...@googlegroups.com
#25651: `GEOSException` during operations on some GeometryCollections
-------------------------------+--------------------------------------
Reporter: sir-sigurd | Owner: sir-sigurd
Type: Uncategorized | Status: assigned
Component: GIS | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by sir-sigurd):

The idea is to use `unary_union` implicitly for both geometries for such
methods as `equals`, `difference`, etc. I'm not sure this is a good idea
and think that this error is occurred really rarely in the wild.

--
Ticket URL: <https://code.djangoproject.com/ticket/25651#comment:3>

Django

unread,
Nov 1, 2015, 2:15:42 PM11/1/15
to django-...@googlegroups.com
#25651: `GEOSException` during operations on some GeometryCollections
-------------------------------+--------------------------------------
Reporter: sir-sigurd | Owner: sir-sigurd
Type: Uncategorized | Status: closed
Component: GIS | Version: 1.8
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by claudep):

* status: assigned => closed
* resolution: => wontfix


Comment:

I'll close it for now, but if anyone comes with a working patch, we can
reconsider the decision.

--
Ticket URL: <https://code.djangoproject.com/ticket/25651#comment:4>

Reply all
Reply to author
Forward
0 new messages