Fixed #30166 -- Dropped support for GDAL 1.11.

This commit is contained in:
Tim Graham 2019-02-07 19:10:34 -05:00
parent 6eb4996672
commit e7fd69d051
7 changed files with 11 additions and 19 deletions

View File

@ -46,7 +46,6 @@ from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import GDALException, SRSException
from django.contrib.gis.gdal.geomtype import OGRGeomType
from django.contrib.gis.gdal.libgdal import GDAL_VERSION
from django.contrib.gis.gdal.prototypes import geom as capi, srs as srs_api
from django.contrib.gis.gdal.srs import CoordTransform, SpatialReference
from django.contrib.gis.geometry import hex_regex, json_regex, wkt_regex
@ -140,14 +139,7 @@ class OGRGeometry(GDALBase):
@staticmethod
def _from_json(geom_input):
ptr = capi.from_json(geom_input)
if GDAL_VERSION < (2, 0):
try:
capi.get_geom_srs(ptr)
except SRSException:
srs = SpatialReference(4326)
capi.assign_srs(ptr, srs.ptr)
return ptr
return capi.from_json(geom_input)
@classmethod
def from_bbox(cls, bbox):

View File

@ -20,10 +20,10 @@ if lib_path:
lib_names = None
elif os.name == 'nt':
# Windows NT shared libraries
lib_names = ['gdal203', 'gdal202', 'gdal201', 'gdal20', 'gdal111']
lib_names = ['gdal203', 'gdal202', 'gdal201', 'gdal20']
elif os.name == 'posix':
# *NIX library names.
lib_names = ['gdal', 'GDAL', 'gdal2.3.0', 'gdal2.2.0', 'gdal2.1.0', 'gdal2.0.0', 'gdal1.11.0']
lib_names = ['gdal', 'GDAL', 'gdal2.3.0', 'gdal2.2.0', 'gdal2.1.0', 'gdal2.0.0']
else:
raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name)

View File

@ -68,7 +68,6 @@ get_field_as_datetime = int_output(
)
get_field_as_double = double_output(lgdal.OGR_F_GetFieldAsDouble, [c_void_p, c_int])
get_field_as_integer = int_output(lgdal.OGR_F_GetFieldAsInteger, [c_void_p, c_int])
if GDAL_VERSION >= (2, 0):
get_field_as_integer64 = int64_output(lgdal.OGR_F_GetFieldAsInteger64, [c_void_p, c_int])
if GDAL_VERSION >= (2, 2):
is_field_set = bool_output(lgdal.OGR_F_IsFieldSetAndNotNull, [c_void_p, c_int])

View File

@ -10,7 +10,7 @@ Program Description Required
======================== ==================================== ================================ ===================================
:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.7, 3.6, 3.5, 3.4
`PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 5.2, 5.1, 5.0, 4.x
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.3, 2.2, 2.1, 2.0, 1.11
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.3, 2.2, 2.1, 2.0
:doc:`GeoIP <../geoip2>` IP-based geolocation library No 2
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.5, 2.4, 2.3, 2.2
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3
@ -25,7 +25,6 @@ totally fine with GeoDjango. Your mileage may vary.
GEOS 3.5.0 2015-08-15
GEOS 3.6.0 2016-10-25
GEOS 3.7.0 2018-09-10
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

View File

@ -229,6 +229,8 @@ backends.
* Support for SpatiaLite 4.1 and 4.2 is removed.
* Support for GDAL 1.11 is removed.
Dropped support for PostgreSQL 9.4
----------------------------------

View File

@ -3,7 +3,7 @@ import re
from datetime import datetime
from django.contrib.gis.gdal import (
GDAL_VERSION, DataSource, Envelope, GDALException, OGRGeometry,
DataSource, Envelope, GDALException, OGRGeometry,
)
from django.contrib.gis.gdal.field import (
OFTDateTime, OFTInteger, OFTReal, OFTString,
@ -38,7 +38,7 @@ ds_list = (
),
TestDS(
'test_vrt', ext='vrt', nfeat=3, nfld=3, geom='POINT', gtype='Point25D',
driver='OGR_VRT' if GDAL_VERSION >= (2, 0) else 'VRT',
driver='OGR_VRT',
fields={
'POINT_X': OFTString,
'POINT_Y': OFTString,

View File

@ -74,7 +74,7 @@ class OGRInspectTest(SimpleTestCase):
'',
'class MyModel(models.Model):',
' float = models.FloatField()',
' int = models.{}()'.format('BigIntegerField' if GDAL_VERSION >= (2, 0) else 'FloatField'),
' int = models.BigIntegerField()',
' str = models.CharField(max_length=80)',
' geom = models.PolygonField(%s)' % self.expected_srid,
]
@ -102,7 +102,7 @@ class OGRInspectTest(SimpleTestCase):
'',
'class City(models.Model):',
' name = models.CharField(max_length=80)',
' population = models.{}()'.format('BigIntegerField' if GDAL_VERSION >= (2, 0) else 'FloatField'),
' population = models.BigIntegerField()',
' density = models.FloatField()',
' created = models.DateField()',
' geom = models.PointField(%s)' % self.expected_srid,