Opened 9 years ago
Closed 9 years ago
#25651 closed Uncategorized (wontfix)
`GEOSException` during operations on some GeometryCollections
Reported by: | Sergey Fedoseev | Owned by: | Sergey Fedoseev |
---|---|---|---|
Component: | GIS | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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 reported it, but if decide to wrap it up in Django, I have an idea for this.
Change History (4)
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
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.
comment:4 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
I'll close it for now, but if anyone comes with a working patch, we can reconsider the decision.
Note:
See TracTickets
for help on using tickets.
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...