From 4968f0012e7f97c613fcb71781c4e50874c31c15 Mon Sep 17 00:00:00 2001 From: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:19:12 +0100 Subject: [PATCH] Refs #35058 -- Removed OGRGeometry.coord_dim setter per deprecation timeline. --- django/contrib/gis/gdal/geometries.py | 12 ------------ docs/ref/contrib/gis/gdal.txt | 9 --------- docs/releases/6.0.txt | 2 ++ tests/gis_tests/gdal_tests/test_geom.py | 11 ----------- 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index 9e712037c0..b65d35bc44 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -40,7 +40,6 @@ """ import sys -import warnings from binascii import b2a_hex from ctypes import byref, c_char_p, c_double, c_ubyte, c_void_p, string_at @@ -52,7 +51,6 @@ from django.contrib.gis.gdal.prototypes import geom as capi from django.contrib.gis.gdal.prototypes import srs as srs_api from django.contrib.gis.gdal.srs import CoordTransform, SpatialReference from django.contrib.gis.geometry import hex_regex, json_regex, wkt_regex -from django.utils.deprecation import RemovedInDjango60Warning from django.utils.encoding import force_bytes @@ -215,16 +213,6 @@ class OGRGeometry(GDALBase): "Return the coordinate dimension of the Geometry." return capi.get_coord_dim(self.ptr) - # RemovedInDjango60Warning - @coord_dim.setter - def coord_dim(self, dim): - "Set the coordinate dimension of this Geometry." - msg = "coord_dim setter is deprecated. Use set_3d() instead." - warnings.warn(msg, RemovedInDjango60Warning, stacklevel=2) - if dim not in (2, 3): - raise ValueError("Geometry dimension must be either 2 or 3") - capi.set_coord_dim(self.ptr, dim) - @property def geom_count(self): "Return the number of elements in this Geometry." diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt index 1ec04d342f..b7e617cfec 100644 --- a/docs/ref/contrib/gis/gdal.txt +++ b/docs/ref/contrib/gis/gdal.txt @@ -551,15 +551,6 @@ coordinate transformation: >>> polygon.dimension 2 - .. attribute:: coord_dim - - Returns the coordinate dimension of this geometry. For example, the value - would be 2 for two-dimensional geometries. - - .. deprecated:: 5.1 - - The ``coord_dim`` setter is deprecated. Use :meth:`.set_3d` instead. - .. attribute:: is_3d A boolean indicating if this geometry has Z coordinates. diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt index 38b0681624..39a81e60e3 100644 --- a/docs/releases/6.0.txt +++ b/docs/releases/6.0.txt @@ -312,3 +312,5 @@ to remove usage of these features. * Support for passing positional arguments to ``Model.save()`` and ``Model.asave()`` is removed. + +* The setter for ``django.contrib.gis.gdal.OGRGeometry.coord_dim`` is removed. diff --git a/tests/gis_tests/gdal_tests/test_geom.py b/tests/gis_tests/gdal_tests/test_geom.py index 6c551d0804..919e547511 100644 --- a/tests/gis_tests/gdal_tests/test_geom.py +++ b/tests/gis_tests/gdal_tests/test_geom.py @@ -13,7 +13,6 @@ from django.contrib.gis.geos import GEOSException from django.template import Context from django.template.engine import Engine from django.test import SimpleTestCase -from django.utils.deprecation import RemovedInDjango60Warning from ..test_data import TestDataMixin @@ -1063,13 +1062,3 @@ class OGRGeomTest(SimpleTestCase, TestDataMixin): ) self.assertIsInstance(geom, CurvePolygon) self.assertIsInstance(geom.shell, CircularString) - - -class DeprecationTests(SimpleTestCase): - def test_coord_setter_deprecation(self): - geom = OGRGeometry("POINT (1 2)") - msg = "coord_dim setter is deprecated. Use set_3d() instead." - with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx: - geom.coord_dim = 3 - self.assertEqual(geom.coord_dim, 3) - self.assertEqual(ctx.filename, __file__)