Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-mm committed Dec 20, 2023
2 parents 9b55bd3 + c709a74 commit 6111afb
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 44 deletions.
2 changes: 0 additions & 2 deletions django/contrib/gis/gdal/libgdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"gdal302",
"gdal301",
"gdal300",
"gdal204",
]
elif os.name == "posix":
# *NIX library names.
Expand All @@ -45,7 +44,6 @@
"gdal3.2.0",
"gdal3.1.0",
"gdal3.0.0",
"gdal2.4.0",
]
else:
raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name)
Expand Down
10 changes: 4 additions & 6 deletions django/contrib/gis/gdal/prototypes/srs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ctypes import POINTER, c_char_p, c_int, c_void_p

from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal, std_call
from django.contrib.gis.gdal.libgdal import lgdal, std_call
from django.contrib.gis.gdal.prototypes.generation import (
const_string_output,
double_output,
Expand Down Expand Up @@ -36,11 +36,9 @@ def units_func(f):
std_call("OSRDestroySpatialReference"), [c_void_p], errcheck=False
)
srs_validate = void_output(lgdal.OSRValidate, [c_void_p])

if GDAL_VERSION >= (3, 0):
set_axis_strategy = void_output(
lgdal.OSRSetAxisMappingStrategy, [c_void_p, c_int], errcheck=False
)
set_axis_strategy = void_output(
lgdal.OSRSetAxisMappingStrategy, [c_void_p, c_int], errcheck=False
)

# Getting the semi_major, semi_minor, and flattening functions.
semi_major = srs_double(lgdal.OSRGetSemiMajor)
Expand Down
9 changes: 2 additions & 7 deletions django/contrib/gis/gdal/srs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import SRSException
from django.contrib.gis.gdal.libgdal import GDAL_VERSION
from django.contrib.gis.gdal.prototypes import srs as capi
from django.utils.encoding import force_bytes, force_str

Expand Down Expand Up @@ -66,10 +65,8 @@ def __init__(self, srs_input="", srs_type="user", axis_order=None):
if srs_type == "wkt":
self.ptr = capi.new_srs(c_char_p(b""))
self.import_wkt(srs_input)
if self.axis_order == AxisOrder.TRADITIONAL and GDAL_VERSION >= (3, 0):
if self.axis_order == AxisOrder.TRADITIONAL:
capi.set_axis_strategy(self.ptr, self.axis_order)
elif self.axis_order != AxisOrder.TRADITIONAL and GDAL_VERSION < (3, 0):
raise ValueError("%s is not supported in GDAL < 3.0." % self.axis_order)
return
elif isinstance(srs_input, str):
try:
Expand Down Expand Up @@ -104,10 +101,8 @@ def __init__(self, srs_input="", srs_type="user", axis_order=None):
else:
self.ptr = srs

if self.axis_order == AxisOrder.TRADITIONAL and GDAL_VERSION >= (3, 0):
if self.axis_order == AxisOrder.TRADITIONAL:
capi.set_axis_strategy(self.ptr, self.axis_order)
elif self.axis_order != AxisOrder.TRADITIONAL and GDAL_VERSION < (3, 0):
raise ValueError("%s is not supported in GDAL < 3.0." % self.axis_order)
# Importing from either the user input string or an integer SRID.
if srs_type == "user":
self.import_user_input(srs_input)
Expand Down
15 changes: 6 additions & 9 deletions docs/ref/contrib/gis/install/geolibs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Installing Geospatial libraries
GeoDjango uses and/or provides interfaces for the following open source
geospatial libraries:

======================== ==================================== ================================ ===========================================
======================== ==================================== ================================ ======================================
Program Description Required Supported Versions
======================== ==================================== ================================ ===========================================
======================== ==================================== ================================ ======================================
:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.12, 3.11, 3.10, 3.9, 3.8
`PROJ`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 9.x, 8.x, 7.x, 6.x, 5.x
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1, 3.0, 2.4
`PROJ`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 9.x, 8.x, 7.x, 6.x
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1, 3.0
:doc:`GeoIP <../geoip2>` IP-based geolocation library No 2
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.4, 3.3, 3.2, 3.1, 3.0
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 5.1, 5.0, 4.3
======================== ==================================== ================================ ===========================================
======================== ==================================== ================================ ======================================

Note that older or more recent versions of these libraries *may* also work
totally fine with GeoDjango. Your mileage may vary.
Expand All @@ -26,7 +26,6 @@ totally fine with GeoDjango. Your mileage may vary.
GEOS 3.10.0 2021-10-20
GEOS 3.11.0 2022-07-01
GEOS 3.12.0 2023-06-27
GDAL 2.4.0 2018-12
GDAL 3.0.0 2019-05
GDAL 3.1.0 2020-05-07
GDAL 3.2.0 2020-11-02
Expand All @@ -45,7 +44,6 @@ totally fine with GeoDjango. Your mileage may vary.
PROJ 8.0.0 2021-03-01
PROJ 7.0.0 2020-02-25
PROJ 6.0.0 2019-02-26
PROJ 5.0.0 2018-03-01
SpatiaLite 4.3.0 2015-09-07
SpatiaLite 5.0.0 2020-08-23
SpatiaLite 5.1.0 2023-08-04
Expand Down Expand Up @@ -191,8 +189,7 @@ PROJ < 7.x) [#]_:
$ wget https://download.osgeo.org/proj/proj-data-X.Y.tar.gz

Next, untar the source code archive, and extract the datum shifting files in the
``data`` subdirectory (use ``nad`` subdirectory for PROJ < 6.x). This must be
done *prior* to configuration:
``data`` subdirectory. This must be done *prior* to configuration:

.. code-block:: shell

Expand Down
4 changes: 4 additions & 0 deletions docs/releases/5.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ backends.

* Support for PostGIS 2.5 is removed.

* Support for PROJ < 6 is removed.

* Support for GDAL 2.4 is removed.

Dropped support for MariaDB 10.4
--------------------------------

Expand Down
21 changes: 11 additions & 10 deletions docs/topics/migrations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,17 @@ meaning that if a migration fails to apply you will have to manually unpick
the changes in order to try again (it's impossible to roll back to an
earlier point).

In addition, MySQL will fully rewrite tables for almost every schema operation
and generally takes a time proportional to the number of rows in the table to
add or remove columns. On slower hardware this can be worse than a minute per
million rows - adding a few columns to a table with just a few million rows
could lock your site up for over ten minutes.

Finally, MySQL has relatively small limits on name lengths for columns, tables
and indexes, as well as a limit on the combined size of all columns an index
covers. This means that indexes that are possible on other backends will
fail to be created under MySQL.
MySQL 8.0 introduced significant performance enhancements for
`DDL operations`_, making them more efficient and reducing the need for full
table rebuilds. However, it cannot guarantee a complete absence of locks or
interruptions. In situations where locks are still necessary, the duration of
these operations will be proportionate to the number of rows involved.

Finally, MySQL has a relatively small limit on the combined size of all columns
an index covers. This means that indexes that are possible on other backends
will fail to be created under MySQL.

.. _DDL operations: https://dev.mysql.com/doc/refman/en/innodb-online-ddl-operations.html

SQLite
------
Expand Down
10 changes: 0 additions & 10 deletions tests/gis_tests/gdal_tests/test_srs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from unittest import skipIf

from django.contrib.gis.gdal import (
GDAL_VERSION,
AxisOrder,
CoordTransform,
GDALException,
Expand Down Expand Up @@ -358,7 +355,6 @@ def test_unicode(self):
self.assertIn("Langschoß", srs.pretty_wkt)
self.assertIn("Langschoß", srs.xml)

@skipIf(GDAL_VERSION < (3, 0), "GDAL >= 3.0 is required")
def test_axis_order(self):
wgs84_trad = SpatialReference(4326, axis_order=AxisOrder.TRADITIONAL)
wgs84_auth = SpatialReference(4326, axis_order=AxisOrder.AUTHORITY)
Expand All @@ -380,12 +376,6 @@ def test_axis_order_invalid(self):
with self.assertRaisesMessage(ValueError, msg):
SpatialReference(4326, axis_order="other")

@skipIf(GDAL_VERSION > (3, 0), "GDAL < 3.0 doesn't support authority.")
def test_axis_order_non_traditional_invalid(self):
msg = "AxisOrder.AUTHORITY is not supported in GDAL < 3.0."
with self.assertRaisesMessage(ValueError, msg):
SpatialReference(4326, axis_order=AxisOrder.AUTHORITY)

def test_esri(self):
srs = SpatialReference("NAD83")
pre_esri_wkt = srs.wkt
Expand Down

0 comments on commit 6111afb

Please sign in to comment.