Commit 034dfbfc authored by Sergey Fedoseev's avatar Sergey Fedoseev Committed by Tim Graham
Browse files

Fixed #25654 -- Added the GEOSGeometry.unary_union property.

parent 1e35dd1a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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))
+1 −0
Original line number Diff line number Diff line
@@ -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(
+15 −0
Original line number Diff line number Diff line
@@ -497,6 +497,21 @@ geometry is a point.
Computes and returns a :class:`Point` guaranteed to be on the interior
of this geometry.

.. attribute:: GEOSGeometry.unary_union

.. versionadded:: 1.10

Computes the union of all the elements of this geometry.

The result obeys the following contract:

* Unioning a set of :class:`LineString`\s has the effect of fully noding and
  dissolving the linework.

* Unioning a set of :class:`Polygon`\s will always return a :class:`Polygon` or
  :class:`MultiPolygon` geometry (unlike :meth:`GEOSGeometry.union`, which may
  return geometries of lower dimension if a topology collapse occurs).

Other Properties & Methods
~~~~~~~~~~~~~~~~~~~~~~~~~~

+4 −0
Original line number Diff line number Diff line
@@ -64,6 +64,10 @@ Minor features
* :ref:`Distance lookups <distance-lookups>` now accept expressions as the
  distance value parameter.

* The new :attr:`GEOSGeometry.unary_union
  <django.contrib.gis.geos.GEOSGeometry.unary_union>` property computes the
  union of all the elements of this geometry.

:mod:`django.contrib.messages`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

+3 −0
Original line number Diff line number Diff line
@@ -421,6 +421,7 @@ linebreaks
linebreaksbr
linenumbers
linestring
linework
Livni
ljust
loaddata
@@ -520,6 +521,7 @@ nestable
neuroscientist
newforms
nginx
noding
nonspatial
nullable
OAuth
@@ -877,6 +879,7 @@ unicode
uninstall
uninstalling
uninstalls
unioning
uniterated
unittest
unittests
Loading