mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
Fixed #33453 -- Dropped support for GDAL 2.1.
This commit is contained in:
parent
2c76c27a95
commit
f605e85af9
@ -225,7 +225,6 @@ OGRFieldTypes = {
|
|||||||
9: OFTDate,
|
9: OFTDate,
|
||||||
10: OFTTime,
|
10: OFTTime,
|
||||||
11: OFTDateTime,
|
11: OFTDateTime,
|
||||||
# New 64-bit integer types in GDAL 2
|
|
||||||
12: OFTInteger64,
|
12: OFTInteger64,
|
||||||
13: OFTInteger64List,
|
13: OFTInteger64List,
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,14 @@ elif os.name == 'nt':
|
|||||||
# Windows NT shared libraries
|
# Windows NT shared libraries
|
||||||
lib_names = [
|
lib_names = [
|
||||||
'gdal303', 'gdal302', 'gdal301', 'gdal300',
|
'gdal303', 'gdal302', 'gdal301', 'gdal300',
|
||||||
'gdal204', 'gdal203', 'gdal202', 'gdal201', 'gdal20',
|
'gdal204', 'gdal203', 'gdal202',
|
||||||
]
|
]
|
||||||
elif os.name == 'posix':
|
elif os.name == 'posix':
|
||||||
# *NIX library names.
|
# *NIX library names.
|
||||||
lib_names = [
|
lib_names = [
|
||||||
'gdal', 'GDAL',
|
'gdal', 'GDAL',
|
||||||
'gdal3.3.0', 'gdal3.2.0', 'gdal3.1.0', 'gdal3.0.0',
|
'gdal3.3.0', 'gdal3.2.0', 'gdal3.1.0', 'gdal3.0.0',
|
||||||
'gdal2.4.0', 'gdal2.3.0', 'gdal2.2.0', 'gdal2.1.0', 'gdal2.0.0',
|
'gdal2.4.0', 'gdal2.3.0', 'gdal2.2.0',
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name)
|
raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
from ctypes import POINTER, c_char_p, c_double, c_int, c_long, c_void_p
|
from ctypes import POINTER, c_char_p, c_double, c_int, c_long, c_void_p
|
||||||
|
|
||||||
from django.contrib.gis.gdal.envelope import OGREnvelope
|
from django.contrib.gis.gdal.envelope import OGREnvelope
|
||||||
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
|
from django.contrib.gis.gdal.libgdal import lgdal
|
||||||
from django.contrib.gis.gdal.prototypes.generation import (
|
from django.contrib.gis.gdal.prototypes.generation import (
|
||||||
bool_output, const_string_output, double_output, geom_output, int64_output,
|
bool_output, const_string_output, double_output, geom_output, int64_output,
|
||||||
int_output, srs_output, void_output, voidptr_output,
|
int_output, srs_output, void_output, voidptr_output,
|
||||||
@ -69,10 +69,7 @@ get_field_as_datetime = int_output(
|
|||||||
get_field_as_double = double_output(lgdal.OGR_F_GetFieldAsDouble, [c_void_p, c_int])
|
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])
|
get_field_as_integer = int_output(lgdal.OGR_F_GetFieldAsInteger, [c_void_p, c_int])
|
||||||
get_field_as_integer64 = int64_output(lgdal.OGR_F_GetFieldAsInteger64, [c_void_p, c_int])
|
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])
|
||||||
is_field_set = bool_output(lgdal.OGR_F_IsFieldSetAndNotNull, [c_void_p, c_int])
|
|
||||||
else:
|
|
||||||
is_field_set = bool_output(lgdal.OGR_F_IsFieldSet, [c_void_p, c_int])
|
|
||||||
get_field_as_string = const_string_output(lgdal.OGR_F_GetFieldAsString, [c_void_p, c_int])
|
get_field_as_string = const_string_output(lgdal.OGR_F_GetFieldAsString, [c_void_p, c_int])
|
||||||
get_field_index = int_output(lgdal.OGR_F_GetFieldIndex, [c_void_p, c_char_p])
|
get_field_index = int_output(lgdal.OGR_F_GetFieldIndex, [c_void_p, c_char_p])
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ to_pretty_wkt = string_output(
|
|||||||
[c_void_p, POINTER(c_char_p), c_int], offset=-2, decoding='utf-8'
|
[c_void_p, POINTER(c_char_p), c_int], offset=-2, decoding='utf-8'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Memory leak fixed in GDAL 1.5; still exists in 1.4.
|
|
||||||
to_xml = string_output(lgdal.OSRExportToXML, [c_void_p, POINTER(c_char_p), c_char_p], offset=-2, decoding='utf-8')
|
to_xml = string_output(lgdal.OSRExportToXML, [c_void_p, POINTER(c_char_p), c_char_p], offset=-2, decoding='utf-8')
|
||||||
|
|
||||||
# String attribute retrieval routines.
|
# String attribute retrieval routines.
|
||||||
|
@ -1521,8 +1521,7 @@ blue.
|
|||||||
to mark pixels that are not valid data. Such pixels should generally not
|
to mark pixels that are not valid data. Such pixels should generally not
|
||||||
be displayed, nor contribute to analysis operations.
|
be displayed, nor contribute to analysis operations.
|
||||||
|
|
||||||
To delete an existing "no data" value, set this property to ``None``
|
To delete an existing "no data" value, set this property to ``None``.
|
||||||
(requires GDAL ≥ 2.1).
|
|
||||||
|
|
||||||
.. method:: datatype(as_string=False)
|
.. method:: datatype(as_string=False)
|
||||||
|
|
||||||
|
@ -5,16 +5,16 @@ Installing Geospatial libraries
|
|||||||
GeoDjango uses and/or provides interfaces for the following open source
|
GeoDjango uses and/or provides interfaces for the following open source
|
||||||
geospatial libraries:
|
geospatial libraries:
|
||||||
|
|
||||||
======================== ==================================== ================================ ======================================
|
======================== ==================================== ================================ =================================
|
||||||
Program Description Required Supported Versions
|
Program Description Required Supported Versions
|
||||||
======================== ==================================== ================================ ======================================
|
======================== ==================================== ================================ =================================
|
||||||
:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.10, 3.9, 3.8, 3.7, 3.6
|
:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.10, 3.9, 3.8, 3.7, 3.6
|
||||||
`PROJ`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 8.x, 7.x, 6.x, 5.x, 4.x
|
`PROJ`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 8.x, 7.x, 6.x, 5.x, 4.x
|
||||||
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.3, 3.2, 3.1, 3.0, 2.4, 2.3, 2.2, 2.1
|
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.3, 3.2, 3.1, 3.0, 2.4, 2.3, 2.2
|
||||||
: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) 3.2, 3.1, 3.0, 2.5, 2.4
|
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.2, 3.1, 3.0, 2.5, 2.4
|
||||||
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 5.0, 4.3
|
`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
|
Note that older or more recent versions of these libraries *may* also work
|
||||||
totally fine with GeoDjango. Your mileage may vary.
|
totally fine with GeoDjango. Your mileage may vary.
|
||||||
@ -26,7 +26,6 @@ totally fine with GeoDjango. Your mileage may vary.
|
|||||||
GEOS 3.8.0 2019-10-10
|
GEOS 3.8.0 2019-10-10
|
||||||
GEOS 3.9.0 2020-12-14
|
GEOS 3.9.0 2020-12-14
|
||||||
GEOS 3.10.0 2021-10-20
|
GEOS 3.10.0 2021-10-20
|
||||||
GDAL 2.1.0 2016-04
|
|
||||||
GDAL 2.2.0 2017-05
|
GDAL 2.2.0 2017-05
|
||||||
GDAL 2.3.0 2018-05
|
GDAL 2.3.0 2018-05
|
||||||
GDAL 2.4.0 2018-12
|
GDAL 2.4.0 2018-12
|
||||||
|
@ -310,6 +310,11 @@ backends.
|
|||||||
``DatabaseOperations.insert_statement()`` method is replaced by
|
``DatabaseOperations.insert_statement()`` method is replaced by
|
||||||
``on_conflict`` that accepts ``django.db.models.constants.OnConflict``.
|
``on_conflict`` that accepts ``django.db.models.constants.OnConflict``.
|
||||||
|
|
||||||
|
:mod:`django.contrib.gis`
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
* Support for GDAL 2.1 is removed.
|
||||||
|
|
||||||
Dropped support for MariaDB 10.2
|
Dropped support for MariaDB 10.2
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ class InspectDbTests(TestCase):
|
|||||||
INSTALLED_APPS={'append': 'django.contrib.gis'},
|
INSTALLED_APPS={'append': 'django.contrib.gis'},
|
||||||
)
|
)
|
||||||
class OGRInspectTest(SimpleTestCase):
|
class OGRInspectTest(SimpleTestCase):
|
||||||
expected_srid = 'srid=-1' if GDAL_VERSION < (2, 2) else ''
|
|
||||||
maxDiff = 1024
|
maxDiff = 1024
|
||||||
|
|
||||||
def test_poly(self):
|
def test_poly(self):
|
||||||
@ -76,7 +75,7 @@ class OGRInspectTest(SimpleTestCase):
|
|||||||
' float = models.FloatField()',
|
' float = models.FloatField()',
|
||||||
' int = models.BigIntegerField()',
|
' int = models.BigIntegerField()',
|
||||||
' str = models.CharField(max_length=80)',
|
' str = models.CharField(max_length=80)',
|
||||||
' geom = models.PolygonField(%s)' % self.expected_srid,
|
' geom = models.PolygonField()',
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assertEqual(model_def, '\n'.join(expected))
|
self.assertEqual(model_def, '\n'.join(expected))
|
||||||
@ -84,7 +83,7 @@ class OGRInspectTest(SimpleTestCase):
|
|||||||
def test_poly_multi(self):
|
def test_poly_multi(self):
|
||||||
shp_file = os.path.join(TEST_DATA, 'test_poly', 'test_poly.shp')
|
shp_file = os.path.join(TEST_DATA, 'test_poly', 'test_poly.shp')
|
||||||
model_def = ogrinspect(shp_file, 'MyModel', multi_geom=True)
|
model_def = ogrinspect(shp_file, 'MyModel', multi_geom=True)
|
||||||
self.assertIn('geom = models.MultiPolygonField(%s)' % self.expected_srid, model_def)
|
self.assertIn('geom = models.MultiPolygonField()', model_def)
|
||||||
# Same test with a 25D-type geometry field
|
# Same test with a 25D-type geometry field
|
||||||
shp_file = os.path.join(TEST_DATA, 'gas_lines', 'gas_leitung.shp')
|
shp_file = os.path.join(TEST_DATA, 'gas_lines', 'gas_leitung.shp')
|
||||||
model_def = ogrinspect(shp_file, 'MyModel', multi_geom=True)
|
model_def = ogrinspect(shp_file, 'MyModel', multi_geom=True)
|
||||||
@ -105,7 +104,7 @@ class OGRInspectTest(SimpleTestCase):
|
|||||||
' population = models.BigIntegerField()',
|
' population = models.BigIntegerField()',
|
||||||
' density = models.FloatField()',
|
' density = models.FloatField()',
|
||||||
' created = models.DateField()',
|
' created = models.DateField()',
|
||||||
' geom = models.PointField(%s)' % self.expected_srid,
|
' geom = models.PointField()',
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assertEqual(model_def, '\n'.join(expected))
|
self.assertEqual(model_def, '\n'.join(expected))
|
||||||
@ -165,7 +164,7 @@ class OGRInspectTest(SimpleTestCase):
|
|||||||
|
|
||||||
def test_mapping_option(self):
|
def test_mapping_option(self):
|
||||||
expected = (
|
expected = (
|
||||||
" geom = models.PointField(%s)\n"
|
" geom = models.PointField()\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\n"
|
"\n"
|
||||||
"# Auto-generated `LayerMapping` dictionary for City model\n"
|
"# Auto-generated `LayerMapping` dictionary for City model\n"
|
||||||
@ -175,7 +174,7 @@ class OGRInspectTest(SimpleTestCase):
|
|||||||
" 'density': 'Density',\n"
|
" 'density': 'Density',\n"
|
||||||
" 'created': 'Created',\n"
|
" 'created': 'Created',\n"
|
||||||
" 'geom': 'POINT',\n"
|
" 'geom': 'POINT',\n"
|
||||||
"}\n" % self.expected_srid)
|
"}\n")
|
||||||
shp_file = os.path.join(TEST_DATA, 'cities', 'cities.shp')
|
shp_file = os.path.join(TEST_DATA, 'cities', 'cities.shp')
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
call_command('ogrinspect', shp_file, '--mapping', 'City', stdout=out)
|
call_command('ogrinspect', shp_file, '--mapping', 'City', stdout=out)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user