﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25651	`GEOSException` during operations on some GeometryCollections	Sergey Fedoseev	Sergey Fedoseev	"
{{{
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.
"	Uncategorized	closed	GIS	1.8	Normal	wontfix			Unreviewed	0	0	0	0	0	0
