From 7e63e84572f076c3cb2988d753a334e204116ddb Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 31 Dec 2016 09:45:55 -0500 Subject: [PATCH] Refs #25773 -- Removed deprecated geos.MultiPolygon.cascaded_union property. --- django/contrib/gis/geos/collections.py | 11 ----------- django/contrib/gis/geos/prototypes/topology.py | 1 - docs/ref/contrib/gis/geos.txt | 12 ------------ docs/releases/2.0.txt | 3 +++ tests/gis_tests/geos_tests/test_geos.py | 9 +-------- 5 files changed, 4 insertions(+), 32 deletions(-) diff --git a/django/contrib/gis/geos/collections.py b/django/contrib/gis/geos/collections.py index 7427a4569f..4935dbd1c3 100644 --- a/django/contrib/gis/geos/collections.py +++ b/django/contrib/gis/geos/collections.py @@ -3,7 +3,6 @@ GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon """ import json -import warnings from ctypes import byref, c_int, c_uint from django.contrib.gis.geos import prototypes as capi @@ -13,7 +12,6 @@ from django.contrib.gis.geos.libgeos import geos_version_info, get_pointer_arr from django.contrib.gis.geos.linestring import LinearRing, LineString from django.contrib.gis.geos.point import Point from django.contrib.gis.geos.polygon import Polygon -from django.utils.deprecation import RemovedInDjango20Warning from django.utils.six.moves import range @@ -128,15 +126,6 @@ class MultiPolygon(GeometryCollection): _allowed = Polygon _typeid = 6 - @property - def cascaded_union(self): - "Returns a cascaded union of this MultiPolygon." - warnings.warn( - "`cascaded_union` is deprecated, use the `unary_union` property instead.", - RemovedInDjango20Warning, 2 - ) - return GEOSGeometry(capi.geos_cascaded_union(self.ptr), self.srid) - # Setting the allowed types here since GeometryCollection is defined before # its subclasses. diff --git a/django/contrib/gis/geos/prototypes/topology.py b/django/contrib/gis/geos/prototypes/topology.py index b2cf0681a8..f8c36bc6f5 100644 --- a/django/contrib/gis/geos/prototypes/topology.py +++ b/django/contrib/gis/geos/prototypes/topology.py @@ -33,7 +33,6 @@ geos_simplify = Topology('GEOSSimplify', argtypes=[GEOM_PTR, c_double]) 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. diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt index 165f3c0754..b92a91491a 100644 --- a/docs/ref/contrib/gis/geos.txt +++ b/docs/ref/contrib/gis/geos.txt @@ -839,17 +839,6 @@ Geometry Collections In previous versions, an empty ``MultiPolygon`` couldn't be instantiated. - .. attribute:: cascaded_union - - .. deprecated:: 1.10 - - Use the :attr:`GEOSGeometry.unary_union` property instead. - - Returns a :class:`Polygon` that is the union of all of the component - polygons in this collection. The algorithm employed is significantly - more efficient (faster) than trying to union the geometries together - individually. [#fncascadedunion]_ - ``GeometryCollection`` ---------------------- @@ -1142,7 +1131,6 @@ include the SRID value (in other words, EWKB). .. rubric:: Footnotes .. [#fnogc] *See* `PostGIS EWKB, EWKT and Canonical Forms `_, PostGIS documentation at Ch. 4.1.2. -.. [#fncascadedunion] For more information, read Paul Ramsey's blog post about `(Much) Faster Unions in PostGIS 1.4 `_ and Martin Davis' blog post on `Fast polygon merging in JTS using Cascaded Union `_. Settings ======== diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index 6025e7de88..0bc5c8d388 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -333,3 +333,6 @@ these features. * The ``get_coords()`` and ``set_coords()`` methods of ``django.contrib.gis.geos.Point`` are removed. + +* The ``cascaded_union`` property of ``django.contrib.gis.geos.MultiPolygon`` + is removed. diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index 4ee3c7309a..46583c9605 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -18,9 +18,8 @@ from django.contrib.gis.geos.libgeos import geos_version_info from django.contrib.gis.shortcuts import numpy from django.template import Context from django.template.engine import Engine -from django.test import SimpleTestCase, ignore_warnings, mock +from django.test import SimpleTestCase, mock from django.utils import six -from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_bytes from django.utils.six.moves import range @@ -1315,9 +1314,3 @@ class GEOSTest(SimpleTestCase, TestDataMixin): self.assertEqual(p.transform(2774, clone=True), Point(srid=2774)) p.transform(2774) self.assertEqual(p, Point(srid=2774)) - - @ignore_warnings(category=RemovedInDjango20Warning) - def test_deprecated_cascaded_union(self): - for geom in self.geometries.multipolygons: - mpoly = GEOSGeometry(geom.wkt) - self.assertEqual(mpoly.cascaded_union, mpoly.unary_union)