summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-06-12 10:51:43 +0200
committerGitHub <noreply@github.com>2019-06-12 10:51:43 +0200
commitb616f65855e5658a0272506ded1274516daa908d (patch)
tree520f148121881abedc10b9ce86965ee0d3a6c81e
parent198a0adef2fd794189cad7cfb80db7c14b8e28c3 (diff)
Added missing support for PointOnSurface function on MariaDB.
-rw-r--r--django/contrib/gis/db/backends/mysql/operations.py1
-rw-r--r--docs/ref/contrib/gis/functions.txt2
-rw-r--r--tests/gis_tests/geoapp/test_functions.py5
3 files changed, 7 insertions, 1 deletions
diff --git a/django/contrib/gis/db/backends/mysql/operations.py b/django/contrib/gis/db/backends/mysql/operations.py
index e765e4d879..e808609802 100644
--- a/django/contrib/gis/db/backends/mysql/operations.py
+++ b/django/contrib/gis/db/backends/mysql/operations.py
@@ -59,6 +59,7 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
'Scale', 'SnapToGrid', 'Transform', 'Translate',
}
if self.connection.mysql_is_mariadb:
+ unsupported.remove('PointOnSurface')
unsupported.update({'GeoHash', 'IsValid'})
if self.connection.mysql_version < (10, 2, 4):
unsupported.add('AsGeoJSON')
diff --git a/docs/ref/contrib/gis/functions.txt b/docs/ref/contrib/gis/functions.txt
index 4a4e1b406b..15434fdd6c 100644
--- a/docs/ref/contrib/gis/functions.txt
+++ b/docs/ref/contrib/gis/functions.txt
@@ -446,7 +446,7 @@ geometry field as a :class:`~django.contrib.gis.measure.Distance` object.
.. class:: PointOnSurface(expression, **extra)
*Availability*: `PostGIS <https://postgis.net/docs/ST_PointOnSurface.html>`__,
-Oracle, SpatiaLite
+MariaDB, Oracle, SpatiaLite
Accepts a single geographic field or expression and returns a ``Point`` geometry
guaranteed to lie on the surface of the field; otherwise returns ``None``.
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py
index 7610a522eb..356f211c86 100644
--- a/tests/gis_tests/geoapp/test_functions.py
+++ b/tests/gis_tests/geoapp/test_functions.py
@@ -370,6 +370,11 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
'New Zealand': fromstr('POINT (174.616364 -36.100861)', srid=4326),
'Texas': fromstr('POINT (-103.002434 36.500397)', srid=4326),
}
+ elif mysql:
+ ref = {
+ 'New Zealand': fromstr('POINT (169.030131 -46.678612)', srid=4326),
+ 'Texas': fromstr('POINT (-97.383730 25.840117)', srid=4326),
+ }
else:
# Using GEOSGeometry to compute the reference point on surface values
# -- since PostGIS also uses GEOS these should be the same.