Fixed #28257 -- Confirmed support for GDAL 2.2
Additionally, a test has been updated to account for small SRS WKT differences. Thanks Tim Graham for writing the doc part.
This commit is contained in:
parent
e0b456bee7
commit
2862760894
|
@ -21,10 +21,10 @@ if lib_path:
|
||||||
lib_names = None
|
lib_names = None
|
||||||
elif os.name == 'nt':
|
elif os.name == 'nt':
|
||||||
# Windows NT shared libraries
|
# Windows NT shared libraries
|
||||||
lib_names = ['gdal201', 'gdal20', 'gdal111', 'gdal110', 'gdal19']
|
lib_names = ['gdal202', 'gdal201', 'gdal20', 'gdal111', 'gdal110', 'gdal19']
|
||||||
elif os.name == 'posix':
|
elif os.name == 'posix':
|
||||||
# *NIX library names.
|
# *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:
|
else:
|
||||||
raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name)
|
raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ Program Description Required
|
||||||
======================== ==================================== ================================ ===================================
|
======================== ==================================== ================================ ===================================
|
||||||
:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.5, 3.4, 3.3
|
: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
|
`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
|
:doc:`GeoIP <../geoip2>` IP-based geolocation library No 2
|
||||||
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.3, 2.2, 2.1
|
`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
|
`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 1.11.0 2014-04-25
|
||||||
GDAL 2.0.0 2015-06
|
GDAL 2.0.0 2015-06
|
||||||
GDAL 2.1.0 2016-04
|
GDAL 2.1.0 2016-04
|
||||||
|
GDAL 2.2.0 2017-05
|
||||||
PostGIS 2.1.0 2013-08-17
|
PostGIS 2.1.0 2013-08-17
|
||||||
PostGIS 2.2.0 2015-10-17
|
PostGIS 2.2.0 2015-10-17
|
||||||
PostGIS 2.3.0 2016-09-26
|
PostGIS 2.3.0 2016-09-26
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from django.contrib.gis.gdal import (
|
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
|
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.
|
# List of acceptable data sources.
|
||||||
ds_list = (
|
ds_list = (
|
||||||
TestDS(
|
TestDS(
|
||||||
'test_point', nfeat=5, nfld=3, geom='POINT', gtype=1, driver='ESRI Shapefile',
|
'test_point', nfeat=5, nfld=3, geom='POINT', gtype=1, driver='ESRI Shapefile',
|
||||||
fields={'dbl': OFTReal, 'int': OFTInteger, 'str': OFTString},
|
fields={'dbl': OFTReal, 'int': OFTInteger, 'str': OFTString},
|
||||||
extent=(-1.35011, 0.166623, -0.524093, 0.824508), # Got extent from QGIS
|
extent=(-1.35011, 0.166623, -0.524093, 0.824508), # Got extent from QGIS
|
||||||
srs_wkt=(
|
srs_wkt=wgs_84_wkt,
|
||||||
'GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",'
|
|
||||||
'6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",'
|
|
||||||
'0.017453292519943295]]'
|
|
||||||
),
|
|
||||||
field_values={
|
field_values={
|
||||||
'dbl': [float(i) for i in range(1, 6)],
|
'dbl': [float(i) for i in range(1, 6)],
|
||||||
'int': list(range(1, 6)),
|
'int': list(range(1, 6)),
|
||||||
|
@ -48,11 +58,7 @@ ds_list = (
|
||||||
driver='ESRI Shapefile',
|
driver='ESRI Shapefile',
|
||||||
fields={'float': OFTReal, 'int': OFTInteger, 'str': OFTString},
|
fields={'float': OFTReal, 'int': OFTInteger, 'str': OFTString},
|
||||||
extent=(-1.01513, -0.558245, 0.161876, 0.839637), # Got extent from QGIS
|
extent=(-1.01513, -0.558245, 0.161876, 0.839637), # Got extent from QGIS
|
||||||
srs_wkt=(
|
srs_wkt=wgs_84_wkt,
|
||||||
'GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",'
|
|
||||||
'6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",'
|
|
||||||
'0.017453292519943295]]'
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -210,11 +216,7 @@ class DataSourceTest(unittest.TestCase):
|
||||||
|
|
||||||
# Making sure the SpatialReference is as expected.
|
# Making sure the SpatialReference is as expected.
|
||||||
if hasattr(source, 'srs_wkt'):
|
if hasattr(source, 'srs_wkt'):
|
||||||
self.assertEqual(
|
self.assertIsNotNone(re.match(wgs_84_wkt_regex, g.srs.wkt))
|
||||||
source.srs_wkt,
|
|
||||||
# Depending on lib versions, WGS_84 might be WGS_1984
|
|
||||||
g.srs.wkt.replace('SPHEROID["WGS_84"', 'SPHEROID["WGS_1984"')
|
|
||||||
)
|
|
||||||
|
|
||||||
def test06_spatial_filter(self):
|
def test06_spatial_filter(self):
|
||||||
"Testing the Layer.spatial_filter property."
|
"Testing the Layer.spatial_filter property."
|
||||||
|
|
Loading…
Reference in New Issue