1
0
mirror of https://github.com/django/django.git synced 2025-06-05 11:39:13 +00:00

Fixed #35049 -- Dropped support for GDAL 2.4.

This commit is contained in:
David Smith 2023-12-20 18:05:40 +00:00 committed by Mariusz Felisiak
parent fa1d0b11e4
commit c709a748ce
6 changed files with 12 additions and 30 deletions

View File

@ -30,7 +30,6 @@ elif os.name == "nt":
"gdal302", "gdal302",
"gdal301", "gdal301",
"gdal300", "gdal300",
"gdal204",
] ]
elif os.name == "posix": elif os.name == "posix":
# *NIX library names. # *NIX library names.
@ -45,7 +44,6 @@ elif os.name == "posix":
"gdal3.2.0", "gdal3.2.0",
"gdal3.1.0", "gdal3.1.0",
"gdal3.0.0", "gdal3.0.0",
"gdal2.4.0",
] ]
else: else:
raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name) raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name)

View File

@ -1,6 +1,6 @@
from ctypes import POINTER, c_char_p, c_int, c_void_p from ctypes import POINTER, c_char_p, c_int, c_void_p
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal, std_call from django.contrib.gis.gdal.libgdal import lgdal, std_call
from django.contrib.gis.gdal.prototypes.generation import ( from django.contrib.gis.gdal.prototypes.generation import (
const_string_output, const_string_output,
double_output, double_output,
@ -36,11 +36,9 @@ destroy_srs = void_output(
std_call("OSRDestroySpatialReference"), [c_void_p], errcheck=False std_call("OSRDestroySpatialReference"), [c_void_p], errcheck=False
) )
srs_validate = void_output(lgdal.OSRValidate, [c_void_p]) srs_validate = void_output(lgdal.OSRValidate, [c_void_p])
set_axis_strategy = void_output(
if GDAL_VERSION >= (3, 0): lgdal.OSRSetAxisMappingStrategy, [c_void_p, c_int], errcheck=False
set_axis_strategy = void_output( )
lgdal.OSRSetAxisMappingStrategy, [c_void_p, c_int], errcheck=False
)
# Getting the semi_major, semi_minor, and flattening functions. # Getting the semi_major, semi_minor, and flattening functions.
semi_major = srs_double(lgdal.OSRGetSemiMajor) semi_major = srs_double(lgdal.OSRGetSemiMajor)

View File

@ -32,7 +32,6 @@ from types import NoneType
from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import SRSException from django.contrib.gis.gdal.error import SRSException
from django.contrib.gis.gdal.libgdal import GDAL_VERSION
from django.contrib.gis.gdal.prototypes import srs as capi from django.contrib.gis.gdal.prototypes import srs as capi
from django.utils.encoding import force_bytes, force_str from django.utils.encoding import force_bytes, force_str
@ -66,10 +65,8 @@ class SpatialReference(GDALBase):
if srs_type == "wkt": if srs_type == "wkt":
self.ptr = capi.new_srs(c_char_p(b"")) self.ptr = capi.new_srs(c_char_p(b""))
self.import_wkt(srs_input) self.import_wkt(srs_input)
if self.axis_order == AxisOrder.TRADITIONAL and GDAL_VERSION >= (3, 0): if self.axis_order == AxisOrder.TRADITIONAL:
capi.set_axis_strategy(self.ptr, self.axis_order) capi.set_axis_strategy(self.ptr, self.axis_order)
elif self.axis_order != AxisOrder.TRADITIONAL and GDAL_VERSION < (3, 0):
raise ValueError("%s is not supported in GDAL < 3.0." % self.axis_order)
return return
elif isinstance(srs_input, str): elif isinstance(srs_input, str):
try: try:
@ -104,10 +101,8 @@ class SpatialReference(GDALBase):
else: else:
self.ptr = srs self.ptr = srs
if self.axis_order == AxisOrder.TRADITIONAL and GDAL_VERSION >= (3, 0): if self.axis_order == AxisOrder.TRADITIONAL:
capi.set_axis_strategy(self.ptr, self.axis_order) capi.set_axis_strategy(self.ptr, self.axis_order)
elif self.axis_order != AxisOrder.TRADITIONAL and GDAL_VERSION < (3, 0):
raise ValueError("%s is not supported in GDAL < 3.0." % self.axis_order)
# Importing from either the user input string or an integer SRID. # Importing from either the user input string or an integer SRID.
if srs_type == "user": if srs_type == "user":
self.import_user_input(srs_input) self.import_user_input(srs_input)

View File

@ -5,16 +5,16 @@ Installing Geospatial libraries
GeoDjango uses and/or provides interfaces for the following open source GeoDjango uses and/or provides interfaces for the following open source
geospatial libraries: geospatial libraries:
======================== ==================================== ================================ =========================================== ======================== ==================================== ================================ ======================================
Program Description Required Supported Versions Program Description Required Supported Versions
======================== ==================================== ================================ =========================================== ======================== ==================================== ================================ ======================================
:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.12, 3.11, 3.10, 3.9, 3.8 :doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.12, 3.11, 3.10, 3.9, 3.8
`PROJ`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 9.x, 8.x, 7.x, 6.x `PROJ`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 9.x, 8.x, 7.x, 6.x
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1, 3.0, 2.4 :doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1, 3.0
:doc:`GeoIP <../geoip2>` IP-based geolocation library No 2 :doc:`GeoIP <../geoip2>` IP-based geolocation library No 2
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.4, 3.3, 3.2, 3.1, 3.0 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.4, 3.3, 3.2, 3.1, 3.0
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 5.1, 5.0, 4.3 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 5.1, 5.0, 4.3
======================== ==================================== ================================ =========================================== ======================== ==================================== ================================ ======================================
Note that older or more recent versions of these libraries *may* also work Note that older or more recent versions of these libraries *may* also work
totally fine with GeoDjango. Your mileage may vary. totally fine with GeoDjango. Your mileage may vary.
@ -26,7 +26,6 @@ totally fine with GeoDjango. Your mileage may vary.
GEOS 3.10.0 2021-10-20 GEOS 3.10.0 2021-10-20
GEOS 3.11.0 2022-07-01 GEOS 3.11.0 2022-07-01
GEOS 3.12.0 2023-06-27 GEOS 3.12.0 2023-06-27
GDAL 2.4.0 2018-12
GDAL 3.0.0 2019-05 GDAL 3.0.0 2019-05
GDAL 3.1.0 2020-05-07 GDAL 3.1.0 2020-05-07
GDAL 3.2.0 2020-11-02 GDAL 3.2.0 2020-11-02

View File

@ -273,6 +273,8 @@ backends.
* Support for PROJ < 6 is removed. * Support for PROJ < 6 is removed.
* Support for GDAL 2.4 is removed.
Dropped support for MariaDB 10.4 Dropped support for MariaDB 10.4
-------------------------------- --------------------------------

View File

@ -1,7 +1,4 @@
from unittest import skipIf
from django.contrib.gis.gdal import ( from django.contrib.gis.gdal import (
GDAL_VERSION,
AxisOrder, AxisOrder,
CoordTransform, CoordTransform,
GDALException, GDALException,
@ -358,7 +355,6 @@ class SpatialRefTest(SimpleTestCase):
self.assertIn("Langschoß", srs.pretty_wkt) self.assertIn("Langschoß", srs.pretty_wkt)
self.assertIn("Langschoß", srs.xml) self.assertIn("Langschoß", srs.xml)
@skipIf(GDAL_VERSION < (3, 0), "GDAL >= 3.0 is required")
def test_axis_order(self): def test_axis_order(self):
wgs84_trad = SpatialReference(4326, axis_order=AxisOrder.TRADITIONAL) wgs84_trad = SpatialReference(4326, axis_order=AxisOrder.TRADITIONAL)
wgs84_auth = SpatialReference(4326, axis_order=AxisOrder.AUTHORITY) wgs84_auth = SpatialReference(4326, axis_order=AxisOrder.AUTHORITY)
@ -380,12 +376,6 @@ class SpatialRefTest(SimpleTestCase):
with self.assertRaisesMessage(ValueError, msg): with self.assertRaisesMessage(ValueError, msg):
SpatialReference(4326, axis_order="other") SpatialReference(4326, axis_order="other")
@skipIf(GDAL_VERSION > (3, 0), "GDAL < 3.0 doesn't support authority.")
def test_axis_order_non_traditional_invalid(self):
msg = "AxisOrder.AUTHORITY is not supported in GDAL < 3.0."
with self.assertRaisesMessage(ValueError, msg):
SpatialReference(4326, axis_order=AxisOrder.AUTHORITY)
def test_esri(self): def test_esri(self):
srs = SpatialReference("NAD83") srs = SpatialReference("NAD83")
pre_esri_wkt = srs.wkt pre_esri_wkt = srs.wkt