summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2019-02-04 12:03:12 -0500
committerTim Graham <timograham@gmail.com>2019-02-04 13:16:38 -0500
commitd47498c5df7e8861c19fea22e5b04229b510bc3e (patch)
tree9ebfc4ae3cf85d5e375873233ad85a7754044056
parent4763c9719135f4de17924d9c8524f1cfe41bc645 (diff)
Fixed #30156 -- Dropped support for SpatiaLite 4.1 and 4.2.
-rw-r--r--django/contrib/gis/db/backends/spatialite/operations.py31
-rw-r--r--django/db/models/functions/math.py6
-rw-r--r--docs/ref/contrib/gis/install/geolibs.txt4
-rw-r--r--docs/ref/contrib/gis/install/index.txt2
-rw-r--r--docs/releases/3.0.txt5
5 files changed, 17 insertions, 31 deletions
diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py
index 78dfa5cfb4..bbce44b9df 100644
--- a/django/contrib/gis/db/backends/spatialite/operations.py
+++ b/django/contrib/gis/db/backends/spatialite/operations.py
@@ -1,6 +1,6 @@
"""
SQL functions reference lists:
-https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html
+https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html
"""
from django.contrib.gis.db.backends.base.operations import (
BaseSpatialOperations,
@@ -9,7 +9,7 @@ from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from django.contrib.gis.db.backends.utils import SpatialOperator
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.geos.geometry import GEOSGeometry, GEOSGeometryBase
-from django.contrib.gis.geos.prototypes.io import wkb_r, wkt_r
+from django.contrib.gis.geos.prototypes.io import wkb_r
from django.contrib.gis.measure import Distance
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.operations import DatabaseOperations
@@ -64,9 +64,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
disallowed_aggregates = (aggregates.Extent3D,)
- @cached_property
- def select(self):
- return 'CAST (AsEWKB(%s) AS BLOB)' if self.spatial_version >= (4, 3, 0) else 'AsText(%s)'
+ select = 'CAST (AsEWKB(%s) AS BLOB)'
function_names = {
'ForcePolygonCW': 'ST_ForceLHR',
@@ -98,8 +96,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
self.connection.settings_dict['NAME'],
)
) from exc
- if version < (4, 1, 0):
- raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 4.1.0 and above.')
+ if version < (4, 3, 0):
+ raise ImproperlyConfigured('GeoDjango supports SpatiaLite 4.3.0 and above.')
return version
def convert_extent(self, box):
@@ -199,21 +197,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
def get_geometry_converter(self, expression):
geom_class = expression.output_field.geom_class
- if self.spatial_version >= (4, 3, 0):
- read = wkb_r().read
-
- def converter(value, expression, connection):
- return None if value is None else GEOSGeometryBase(read(value), geom_class)
- else:
- read = wkt_r().read
- srid = expression.output_field.srid
- if srid == -1:
- srid = None
+ read = wkb_r().read
- def converter(value, expression, connection):
- if value is not None:
- geom = GEOSGeometryBase(read(value), geom_class)
- if srid:
- geom.srid = srid
- return geom
+ def converter(value, expression, connection):
+ return None if value is None else GEOSGeometryBase(read(value), geom_class)
return converter
diff --git a/django/db/models/functions/math.py b/django/db/models/functions/math.py
index 43cbc17a1e..1a574eb9ab 100644
--- a/django/db/models/functions/math.py
+++ b/django/db/models/functions/math.py
@@ -34,12 +34,10 @@ class ATan2(NumericOutputFieldMixin, Func):
arity = 2
def as_sqlite(self, compiler, connection, **extra_context):
- if not getattr(connection.ops, 'spatialite', False) or not (
- (4, 3, 0) <= connection.ops.spatial_version < (5, 0, 0)
- ):
+ if not getattr(connection.ops, 'spatialite', False) or connection.ops.spatial_version >= (5, 0, 0):
return self.as_sql(compiler, connection)
# This function is usually ATan2(y, x), returning the inverse tangent
- # of y / x, but it's ATan2(x, y) on SpatiaLite >= 4.3.0, < 5.0.0.
+ # of y / x, but it's ATan2(x, y) on SpatiaLite < 5.0.0.
# Cast integers to float to avoid inconsistent/buggy behavior if the
# arguments are mixed between integer and float or decimal.
# https://www.gaia-gis.it/fossil/libspatialite/tktview?name=0f72cca3a2
diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt
index 071c05b732..f52a12c0d7 100644
--- a/docs/ref/contrib/gis/install/geolibs.txt
+++ b/docs/ref/contrib/gis/install/geolibs.txt
@@ -13,7 +13,7 @@ Program Description Required
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.3, 2.2, 2.1, 2.0, 1.11
: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, 2.1
-`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3, 4.2, 4.1
+`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3
======================== ==================================== ================================ ===================================
Note that older or more recent versions of these libraries *may* also work
@@ -35,8 +35,6 @@ totally fine with GeoDjango. Your mileage may vary.
PostGIS 2.3.0 2016-09-26
PostGIS 2.4.0 2017-09-30
PostGIS 2.5.0 2018-09-23
- SpatiaLite 4.1.0 2013-06-04
- SpatiaLite 4.2.0 2014-07-25
SpatiaLite 4.3.0 2015-09-07
.. note::
diff --git a/docs/ref/contrib/gis/install/index.txt b/docs/ref/contrib/gis/install/index.txt
index 941afe82d8..e588cb285a 100644
--- a/docs/ref/contrib/gis/install/index.txt
+++ b/docs/ref/contrib/gis/install/index.txt
@@ -61,7 +61,7 @@ Database Library Requirements Supported Versions Notes
PostgreSQL GEOS, GDAL, PROJ.4, PostGIS 9.4+ Requires PostGIS.
MySQL GEOS, GDAL 5.6+ Not OGC-compliant; :ref:`limited functionality <mysql-spatial-limitations>`.
Oracle GEOS, GDAL 12.1+ XE not supported.
-SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.8.3+ Requires SpatiaLite 4.1+
+SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.8.3+ Requires SpatiaLite 4.3+
================== ============================== ================== =========================================
See also `this comparison matrix`__ on the OSGeo Wiki for
diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt
index f0f17eac7c..4814f62e86 100644
--- a/docs/releases/3.0.txt
+++ b/docs/releases/3.0.txt
@@ -222,6 +222,11 @@ backends.
``can_return_ids_from_bulk_insert`` are renamed to
``can_return_columns_from_insert`` and ``can_return_rows_from_bulk_insert``.
+:mod:`django.contrib.gis`
+-------------------------
+
+* Support for SpatiaLite 4.1 and 4.2 is removed.
+
Miscellaneous
-------------