From 860903b261517442098bdf14e44f4fd4ae20aeb9 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 11 Jun 2018 08:33:09 -0400 Subject: [PATCH] Dropped support for GDAL 1.9 and 1.10. --- django/contrib/gis/gdal/libgdal.py | 4 +- django/contrib/gis/gdal/prototypes/raster.py | 5 +- django/contrib/gis/gdal/raster/base.py | 3 - docs/ref/contrib/gis/install/geolibs.txt | 4 +- docs/releases/2.2.txt | 2 +- tests/gis_tests/gdal_tests/test_raster.py | 68 +++++++++----------- 6 files changed, 35 insertions(+), 51 deletions(-) diff --git a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py index 1e27cb4a37..fa39362c30 100644 --- a/django/contrib/gis/gdal/libgdal.py +++ b/django/contrib/gis/gdal/libgdal.py @@ -21,10 +21,10 @@ if lib_path: lib_names = None elif os.name == 'nt': # Windows NT shared libraries - lib_names = ['gdal202', 'gdal201', 'gdal20', 'gdal111', 'gdal110', 'gdal19'] + lib_names = ['gdal202', 'gdal201', 'gdal20', 'gdal111'] elif os.name == 'posix': # *NIX library names. - lib_names = ['gdal', 'GDAL', 'gdal2.2.0', 'gdal2.1.0', 'gdal2.0.0', 'gdal1.11.0', 'gdal1.10.0', 'gdal1.9.0'] + lib_names = ['gdal', 'GDAL', 'gdal2.2.0', 'gdal2.1.0', 'gdal2.0.0', 'gdal1.11.0'] else: raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name) diff --git a/django/contrib/gis/gdal/prototypes/raster.py b/django/contrib/gis/gdal/prototypes/raster.py index 14cb512245..9e44424a37 100644 --- a/django/contrib/gis/gdal/prototypes/raster.py +++ b/django/contrib/gis/gdal/prototypes/raster.py @@ -51,10 +51,7 @@ set_ds_geotransform = void_output(std_call('GDALSetGeoTransform'), [c_void_p, PO get_ds_metadata = chararray_output(std_call('GDALGetMetadata'), [c_void_p, c_char_p], errcheck=False) set_ds_metadata = void_output(std_call('GDALSetMetadata'), [c_void_p, POINTER(c_char_p), c_char_p]) -if GDAL_VERSION >= (1, 11): - get_ds_metadata_domain_list = chararray_output(std_call('GDALGetMetadataDomainList'), [c_void_p], errcheck=False) -else: - get_ds_metadata_domain_list = None +get_ds_metadata_domain_list = chararray_output(std_call('GDALGetMetadataDomainList'), [c_void_p], errcheck=False) get_ds_metadata_item = const_string_output(std_call('GDALGetMetadataItem'), [c_void_p, c_char_p, c_char_p]) set_ds_metadata_item = const_string_output(std_call('GDALSetMetadataItem'), [c_void_p, c_char_p, c_char_p, c_char_p]) free_dsl = void_output(std_call('CSLDestroy'), [POINTER(c_char_p)], errcheck=False) diff --git a/django/contrib/gis/gdal/raster/base.py b/django/contrib/gis/gdal/raster/base.py index 5bf3fb804e..c5b438ee64 100644 --- a/django/contrib/gis/gdal/raster/base.py +++ b/django/contrib/gis/gdal/raster/base.py @@ -13,9 +13,6 @@ class GDALRasterBase(GDALBase): nested dictionary, where the first-level key is the metadata domain and the second-level is the metadata item names and values for that domain. """ - if not capi.get_ds_metadata_domain_list: - raise ValueError('GDAL ≥ 1.11 is required for using the metadata property.') - # The initial metadata domain list contains the default domain. # The default is returned if domain name is None. domain_list = ['DEFAULT'] diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt index 7800f1ab62..f483052e47 100644 --- a/docs/ref/contrib/gis/install/geolibs.txt +++ b/docs/ref/contrib/gis/install/geolibs.txt @@ -10,7 +10,7 @@ Program Description Required ======================== ==================================== ================================ =================================== :doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.6, 3.5, 3.4 `PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 4.9, 4.8, 4.7, 4.6, 4.5, 4.4 -:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.2, 2.1, 2.0, 1.11, 1.10, 1.9 +:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.2, 2.1, 2.0, 1.11 :doc:`GeoIP <../geoip2>` IP-based geolocation library No 2 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.4, 2.3, 2.2, 2.1 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3, 4.2, 4.1 @@ -24,8 +24,6 @@ totally fine with GeoDjango. Your mileage may vary. GEOS 3.4.0 2013-08-11 GEOS 3.5.0 2015-08-15 GEOS 3.6.0 2016-10-25 - GDAL 1.9.0 2012-01-03 - GDAL 1.10.0 2013-04-29 GDAL 1.11.0 2014-04-25 GDAL 2.0.0 2015-06 GDAL 2.1.0 2016-04 diff --git a/docs/releases/2.2.txt b/docs/releases/2.2.txt index 2f865c16ce..3e51e3c536 100644 --- a/docs/releases/2.2.txt +++ b/docs/releases/2.2.txt @@ -207,7 +207,7 @@ Database backend API :mod:`django.contrib.gis` ------------------------- -* ... +* Support for GDAL 1.9 and 1.10 is dropped. Miscellaneous ------------- diff --git a/tests/gis_tests/gdal_tests/test_raster.py b/tests/gis_tests/gdal_tests/test_raster.py index 42eacb9ea5..3a700cdf9e 100644 --- a/tests/gis_tests/gdal_tests/test_raster.py +++ b/tests/gis_tests/gdal_tests/test_raster.py @@ -277,13 +277,6 @@ class GDALRasterTests(SimpleTestCase): self.assertEqual(result, [0] * 4) def test_raster_metadata_property(self): - # Check for required gdal version. - if GDAL_VERSION < (1, 11): - msg = 'GDAL ≥ 1.11 is required for using the metadata property.' - with self.assertRaisesMessage(ValueError, msg): - self.rs.metadata - return - data = self.rs.metadata self.assertEqual(data['DEFAULT'], {'AREA_OR_POINT': 'Area'}) self.assertEqual(data['IMAGE_STRUCTURE'], {'INTERLEAVE': 'BAND'}) @@ -378,37 +371,36 @@ class GDALRasterTests(SimpleTestCase): compressed = self.rs.warp({'papsz_options': {'compress': 'packbits'}, 'name': rstfile.name}) # Check physically if compression worked. self.assertLess(os.path.getsize(compressed.name), os.path.getsize(self.rs.name)) - if GDAL_VERSION > (1, 11): - # Create file-based raster with options from scratch. - compressed = GDALRaster({ - 'datatype': 1, - 'driver': 'tif', - 'name': rstfile.name, - 'width': 40, - 'height': 40, - 'srid': 3086, - 'origin': (500000, 400000), - 'scale': (100, -100), - 'skew': (0, 0), - 'bands': [{ - 'data': range(40 ^ 2), - 'nodata_value': 255, - }], - 'papsz_options': { - 'compress': 'packbits', - 'pixeltype': 'signedbyte', - 'blockxsize': 23, - 'blockysize': 23, - } - }) - # Check if options used on creation are stored in metadata. - # Reopening the raster ensures that all metadata has been written - # to the file. - compressed = GDALRaster(compressed.name) - self.assertEqual(compressed.metadata['IMAGE_STRUCTURE']['COMPRESSION'], 'PACKBITS',) - self.assertEqual(compressed.bands[0].metadata['IMAGE_STRUCTURE']['PIXELTYPE'], 'SIGNEDBYTE') - if GDAL_VERSION >= (2, 1): - self.assertIn('Block=40x23', compressed.info) + # Create file-based raster with options from scratch. + compressed = GDALRaster({ + 'datatype': 1, + 'driver': 'tif', + 'name': rstfile.name, + 'width': 40, + 'height': 40, + 'srid': 3086, + 'origin': (500000, 400000), + 'scale': (100, -100), + 'skew': (0, 0), + 'bands': [{ + 'data': range(40 ^ 2), + 'nodata_value': 255, + }], + 'papsz_options': { + 'compress': 'packbits', + 'pixeltype': 'signedbyte', + 'blockxsize': 23, + 'blockysize': 23, + } + }) + # Check if options used on creation are stored in metadata. + # Reopening the raster ensures that all metadata has been written + # to the file. + compressed = GDALRaster(compressed.name) + self.assertEqual(compressed.metadata['IMAGE_STRUCTURE']['COMPRESSION'], 'PACKBITS',) + self.assertEqual(compressed.bands[0].metadata['IMAGE_STRUCTURE']['PIXELTYPE'], 'SIGNEDBYTE') + if GDAL_VERSION >= (2, 1): + self.assertIn('Block=40x23', compressed.info) def test_raster_warp(self): # Create in memory raster