diff --git a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py index 96acee9f5e..1e27cb4a37 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 = ['gdal201', 'gdal20', 'gdal111', 'gdal110', 'gdal19'] + lib_names = ['gdal202', 'gdal201', 'gdal20', 'gdal111', 'gdal110', 'gdal19'] elif os.name == 'posix': # *NIX library names. - lib_names = ['gdal', 'GDAL', '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', 'gdal1.10.0', 'gdal1.9.0'] else: raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name) diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt index 8d6281539b..7e4e40ff13 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.5, 3.4, 3.3 `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.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, 1.10, 1.9 :doc:`GeoIP <../geoip2>` IP-based geolocation library No 2 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.3, 2.2, 2.1 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3, 4.2, 4.1, 4.0 @@ -34,6 +34,7 @@ totally fine with GeoDjango. Your mileage may vary. GDAL 1.11.0 2014-04-25 GDAL 2.0.0 2015-06 GDAL 2.1.0 2016-04 + GDAL 2.2.0 2017-05 PostGIS 2.1.0 2013-08-17 PostGIS 2.2.0 2015-10-17 PostGIS 2.3.0 2016-09-26 diff --git a/tests/gis_tests/gdal_tests/test_ds.py b/tests/gis_tests/gdal_tests/test_ds.py index 7bc48c6824..0cf0abdc70 100644 --- a/tests/gis_tests/gdal_tests/test_ds.py +++ b/tests/gis_tests/gdal_tests/test_ds.py @@ -1,4 +1,5 @@ import os +import re import unittest from django.contrib.gis.gdal import ( @@ -9,17 +10,26 @@ from django.contrib.gis.gdal.field import OFTInteger, OFTReal, OFTString from ..test_data import TEST_DATA, TestDS, get_ds_file +wgs_84_wkt = ( + 'GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",' + '6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",' + '0.017453292519943295]]' +) +# Using a regex because of small differences depending on GDAL versions. +# AUTHORITY part has been added in GDAL 2.2. +wgs_84_wkt_regex = ( + r'^GEOGCS\["GCS_WGS_1984",DATUM\["WGS_1984",SPHEROID\["WGS_(19)?84",' + r'6378137,298.257223563\]\],PRIMEM\["Greenwich",0\],UNIT\["Degree",' + r'0.017453292519943295\](,AUTHORITY\["EPSG","4326"\])?\]$' +) + # List of acceptable data sources. ds_list = ( TestDS( 'test_point', nfeat=5, nfld=3, geom='POINT', gtype=1, driver='ESRI Shapefile', fields={'dbl': OFTReal, 'int': OFTInteger, 'str': OFTString}, extent=(-1.35011, 0.166623, -0.524093, 0.824508), # Got extent from QGIS - srs_wkt=( - 'GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",' - '6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",' - '0.017453292519943295]]' - ), + srs_wkt=wgs_84_wkt, field_values={ 'dbl': [float(i) for i in range(1, 6)], 'int': list(range(1, 6)), @@ -48,11 +58,7 @@ ds_list = ( driver='ESRI Shapefile', fields={'float': OFTReal, 'int': OFTInteger, 'str': OFTString}, extent=(-1.01513, -0.558245, 0.161876, 0.839637), # Got extent from QGIS - srs_wkt=( - 'GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",' - '6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",' - '0.017453292519943295]]' - ), + srs_wkt=wgs_84_wkt, ) ) @@ -210,11 +216,7 @@ class DataSourceTest(unittest.TestCase): # Making sure the SpatialReference is as expected. if hasattr(source, 'srs_wkt'): - self.assertEqual( - source.srs_wkt, - # Depending on lib versions, WGS_84 might be WGS_1984 - g.srs.wkt.replace('SPHEROID["WGS_84"', 'SPHEROID["WGS_1984"') - ) + self.assertIsNotNone(re.match(wgs_84_wkt_regex, g.srs.wkt)) def test06_spatial_filter(self): "Testing the Layer.spatial_filter property."