diff --git a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py index fe510ac142..30cba0f14f 100644 --- a/django/contrib/gis/gdal/libgdal.py +++ b/django/contrib/gis/gdal/libgdal.py @@ -22,6 +22,7 @@ if lib_path: elif os.name == "nt": # Windows NT shared libraries lib_names = [ + "gdal307", "gdal306", "gdal305", "gdal304", @@ -36,6 +37,7 @@ elif os.name == "posix": lib_names = [ "gdal", "GDAL", + "gdal3.7.0", "gdal3.6.0", "gdal3.5.0", "gdal3.4.0", diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt index f46f0978fe..fbe2752e44 100644 --- a/docs/ref/contrib/gis/gdal.txt +++ b/docs/ref/contrib/gis/gdal.txt @@ -1844,8 +1844,8 @@ Key Default Usage converted to the correct string format upon creation. The following example uses some of the options available for the - `GTiff driver`__. The result is a compressed signed byte raster with an - internal tiling scheme. The internal tiles have a block size of 23 by 23: + `GTiff driver`__. The result is a compressed raster with an internal tiling + scheme. The internal tiles have a block size of 23 by 23: .. code-block:: pycon @@ -1859,7 +1859,6 @@ Key Default Usage ... "nr_of_bands": 1, ... "papsz_options": { ... "compress": "packbits", - ... "pixeltype": "signedbyte", ... "tiled": "yes", ... "blockxsize": 23, ... "blockysize": 23, diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt index 1475d512b0..3615e50fdc 100644 --- a/docs/ref/contrib/gis/install/geolibs.txt +++ b/docs/ref/contrib/gis/install/geolibs.txt @@ -5,16 +5,16 @@ Installing Geospatial libraries GeoDjango uses and/or provides interfaces for the following open source geospatial libraries: -======================== ==================================== ================================ ====================================== +======================== ==================================== ================================ =========================================== Program Description Required Supported Versions -======================== ==================================== ================================ ====================================== +======================== ==================================== ================================ =========================================== :doc:`GEOS <../geos>` Geometry Engine Open Source Yes 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, 5.x -:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 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, 2.4 :doc:`GeoIP <../geoip2>` IP-based geolocation library No 2 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.3, 3.2, 3.1, 3.0, 2.5 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 5.0, 4.3 -======================== ==================================== ================================ ====================================== +======================== ==================================== ================================ =========================================== Note that older or more recent versions of these libraries *may* also work totally fine with GeoDjango. Your mileage may vary. @@ -33,6 +33,7 @@ totally fine with GeoDjango. Your mileage may vary. GDAL 3.4.0 2021-11-04 GDAL 3.5.0 2022-05-13 GDAL 3.6.0 2022-11-03 + GDAL 3.7.0 2023-05-10 PostGIS 2.5.0 2018-09-23 PostGIS 3.0.0 2019-10-20 PostGIS 3.1.0 2020-12-18 diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt index f5f4ecd668..a2a04c6060 100644 --- a/docs/releases/5.0.txt +++ b/docs/releases/5.0.txt @@ -179,6 +179,8 @@ Minor features * :ref:`GIS aggregates ` now support the ``filter`` argument. +* Added support for GDAL 3.7. + :mod:`django.contrib.messages` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/gis_tests/gdal_tests/test_raster.py b/tests/gis_tests/gdal_tests/test_raster.py index c662366bef..67108cbb32 100644 --- a/tests/gis_tests/gdal_tests/test_raster.py +++ b/tests/gis_tests/gdal_tests/test_raster.py @@ -6,7 +6,7 @@ import zipfile from pathlib import Path from unittest import mock -from django.contrib.gis.gdal import GDALRaster, SpatialReference +from django.contrib.gis.gdal import GDAL_VERSION, GDALRaster, SpatialReference from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.raster.band import GDALBand from django.contrib.gis.shortcuts import numpy @@ -415,9 +415,19 @@ class GDALRasterTests(SimpleTestCase): # Check physically if compression worked. self.assertLess(os.path.getsize(compressed.name), os.path.getsize(self.rs.name)) # Create file-based raster with options from scratch. + papsz_options = { + "compress": "packbits", + "blockxsize": 23, + "blockysize": 23, + } + if GDAL_VERSION < (3, 7): + datatype = 1 + papsz_options["pixeltype"] = "signedbyte" + else: + datatype = 14 compressed = GDALRaster( { - "datatype": 1, + "datatype": datatype, "driver": "tif", "name": rstfile.name, "width": 40, @@ -432,12 +442,7 @@ class GDALRasterTests(SimpleTestCase): "nodata_value": 255, } ], - "papsz_options": { - "compress": "packbits", - "pixeltype": "signedbyte", - "blockxsize": 23, - "blockysize": 23, - }, + "papsz_options": papsz_options, } ) # Check if options used on creation are stored in metadata. @@ -448,9 +453,12 @@ class GDALRasterTests(SimpleTestCase): compressed.metadata["IMAGE_STRUCTURE"]["COMPRESSION"], "PACKBITS", ) - self.assertEqual( - compressed.bands[0].metadata["IMAGE_STRUCTURE"]["PIXELTYPE"], "SIGNEDBYTE" - ) + self.assertEqual(compressed.bands[0].datatype(), datatype) + if GDAL_VERSION < (3, 7): + self.assertEqual( + compressed.bands[0].metadata["IMAGE_STRUCTURE"]["PIXELTYPE"], + "SIGNEDBYTE", + ) self.assertIn("Block=40x23", compressed.info) def test_raster_warp(self):