1
0
mirror of https://github.com/django/django.git synced 2025-08-22 09:49:12 +00:00

Fixed #36382 -- Confirmed support for GDAL 3.11.

TIGER driver was removed in GDAL 3.11.

eb793be039
This commit is contained in:
David Smith 2025-08-12 08:47:03 +01:00 committed by Sarah Boyce
parent 7063d31cc3
commit fb0d463b1f
5 changed files with 26 additions and 11 deletions

View File

@ -4,8 +4,7 @@ an interface for reading vector geometry data from many different file
formats (including ESRI shapefiles). formats (including ESRI shapefiles).
When instantiating a DataSource object, use the filename of a When instantiating a DataSource object, use the filename of a
GDAL-supported data source. For example, an SHP file or a GDAL-supported data source. For example, an SHP file.
TIGER/Line file from the government.
The ds_driver keyword is used internally when a ctypes pointer The ds_driver keyword is used internally when a ctypes pointer
is passed in directly. is passed in directly.

View File

@ -2,6 +2,7 @@ from ctypes import c_void_p
from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.libgdal import GDAL_VERSION
from django.contrib.gis.gdal.prototypes import ds as capi from django.contrib.gis.gdal.prototypes import ds as capi
from django.utils.encoding import force_bytes, force_str from django.utils.encoding import force_bytes, force_str
@ -23,8 +24,6 @@ class Driver(GDALBase):
"esri": "ESRI Shapefile", "esri": "ESRI Shapefile",
"shp": "ESRI Shapefile", "shp": "ESRI Shapefile",
"shape": "ESRI Shapefile", "shape": "ESRI Shapefile",
"tiger": "TIGER",
"tiger/line": "TIGER",
# raster # raster
"tiff": "GTiff", "tiff": "GTiff",
"tif": "GTiff", "tif": "GTiff",
@ -32,6 +31,14 @@ class Driver(GDALBase):
"jpg": "JPEG", "jpg": "JPEG",
} }
if GDAL_VERSION[:2] <= (3, 10):
_alias.update(
{
"tiger": "TIGER",
"tiger/line": "TIGER",
}
)
def __init__(self, dr_input): def __init__(self, dr_input):
""" """
Initialize an GDAL/OGR driver on either a string or integer input. Initialize an GDAL/OGR driver on either a string or integer input.

View File

@ -22,6 +22,7 @@ if lib_path:
elif os.name == "nt": elif os.name == "nt":
# Windows NT shared libraries # Windows NT shared libraries
lib_names = [ lib_names = [
"gdal311",
"gdal310", "gdal310",
"gdal309", "gdal309",
"gdal308", "gdal308",
@ -38,6 +39,7 @@ elif os.name == "posix":
lib_names = [ lib_names = [
"gdal", "gdal",
"GDAL", "GDAL",
"gdal3.11.0",
"gdal3.10.0", "gdal3.10.0",
"gdal3.9.0", "gdal3.9.0",
"gdal3.8.0", "gdal3.8.0",

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.13, 3.12, 3.11, 3.10, 3.9, 3.8 :doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.13, 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.10, 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1 :doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.11, 3.10, 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1
: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.5, 3.4, 3.3, 3.2, 3.1 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.5, 3.4, 3.3, 3.2, 3.1
`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.
@ -37,6 +37,7 @@ totally fine with GeoDjango. Your mileage may vary.
GDAL 3.8.0 2023-11-13 GDAL 3.8.0 2023-11-13
GDAL 3.9.0 2024-05-10 GDAL 3.9.0 2024-05-10
GDAL 3.10.0 2024-11-06 GDAL 3.10.0 2024-11-06
GDAL 3.11.0 2025-05-09
PostGIS 3.1.0 2020-12-18 PostGIS 3.1.0 2020-12-18
PostGIS 3.2.0 2021-12-18 PostGIS 3.2.0 2021-12-18
PostGIS 3.3.0 2022-08-27 PostGIS 3.3.0 2022-08-27

View File

@ -1,13 +1,12 @@
import unittest import unittest
from unittest import mock from unittest import mock
from django.contrib.gis.gdal import Driver, GDALException from django.contrib.gis.gdal import GDAL_VERSION, Driver, GDALException
valid_drivers = ( valid_drivers = (
# vector # vector
"ESRI Shapefile", "ESRI Shapefile",
"MapInfo File", "MapInfo File",
"TIGER",
"S57", "S57",
"DGN", "DGN",
"Memory", "Memory",
@ -25,7 +24,6 @@ invalid_drivers = ("Foo baz", "clucka", "ESRI Shp", "ESRI rast")
aliases = { aliases = {
"eSrI": "ESRI Shapefile", "eSrI": "ESRI Shapefile",
"TigER/linE": "TIGER",
"SHAPE": "ESRI Shapefile", "SHAPE": "ESRI Shapefile",
"sHp": "ESRI Shapefile", "sHp": "ESRI Shapefile",
"tiFf": "GTiff", "tiFf": "GTiff",
@ -34,6 +32,14 @@ aliases = {
"jpG": "JPEG", "jpG": "JPEG",
} }
if GDAL_VERSION[:2] <= (3, 10):
aliases.update(
{
"tiger": "TIGER",
"tiger/line": "TIGER",
}
)
class DriverTest(unittest.TestCase): class DriverTest(unittest.TestCase):
def test01_valid_driver(self): def test01_valid_driver(self):