summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2015-11-09 22:36:12 +0500
committerTim Graham <timograham@gmail.com>2015-11-18 19:17:16 -0500
commit034dfbfc057b6090f9f2589731b8f58a70e4f885 (patch)
tree6d3d8a6437992f29ff17e2628ce667fe2c5924de /django
parent1e35dd1a053b620f065101c02069c8e142ebf8ec (diff)
Fixed #25654 -- Added the GEOSGeometry.unary_union property.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/geos/geometry.py5
-rw-r--r--django/contrib/gis/geos/prototypes/topology.py1
2 files changed, 6 insertions, 0 deletions
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index 78e6aa900b..d0d0d9f008 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -621,6 +621,11 @@ class GEOSGeometry(GEOSBase, ListMixin):
"""
return self._topology(capi.geos_symdifference(self.ptr, other.ptr))
+ @property
+ def unary_union(self):
+ "Return the union of all the elements of this geometry."
+ return self._topology(capi.geos_unary_union(self.ptr))
+
def union(self, other):
"Returns a Geometry representing all the points in this Geometry and other."
return self._topology(capi.geos_union(self.ptr, other.ptr))
diff --git a/django/contrib/gis/geos/prototypes/topology.py b/django/contrib/gis/geos/prototypes/topology.py
index fa7af0e066..b2cf0681a8 100644
--- a/django/contrib/gis/geos/prototypes/topology.py
+++ b/django/contrib/gis/geos/prototypes/topology.py
@@ -34,6 +34,7 @@ geos_symdifference = Topology('GEOSSymDifference', argtypes=[GEOM_PTR, GEOM_PTR]
geos_union = Topology('GEOSUnion', argtypes=[GEOM_PTR, GEOM_PTR])
geos_cascaded_union = GEOSFuncFactory('GEOSUnionCascaded', argtypes=[GEOM_PTR], restype=GEOM_PTR)
+geos_unary_union = GEOSFuncFactory('GEOSUnaryUnion', argtypes=[GEOM_PTR], restype=GEOM_PTR)
# GEOSRelate returns a string, not a geometry.
geos_relate = GEOSFuncFactory(