1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #30562 -- Doc'd MariaDB support for GIS spatial lookups.

This commit is contained in:
Mariusz Felisiak 2019-10-16 13:16:30 +02:00 committed by Carlton Gibson
parent 440603a4bc
commit 1c5ec221a4
2 changed files with 66 additions and 50 deletions

View File

@ -219,7 +219,7 @@ in the :doc:`model-api` documentation for more details.
Distance Lookups
----------------
*Availability*: PostGIS, MySQL, Oracle, SpatiaLite, PGRaster (Native)
*Availability*: PostGIS, MariaDB, MySQL, Oracle, SpatiaLite, PGRaster (Native)
The following distance lookups are available:
@ -227,7 +227,7 @@ The following distance lookups are available:
* :lookup:`distance_lte`
* :lookup:`distance_gt`
* :lookup:`distance_gte`
* :lookup:`dwithin` (except MySQL)
* :lookup:`dwithin` (except MariaDB and MySQL)
.. note::
@ -310,41 +310,41 @@ divided into the three categories described in the :ref:`raster lookup details
<spatial-lookup-raster>`: native support ``N``, bilateral native support ``B``,
and geometry conversion support ``C``.
================================= ========= ======== ============ ========== ========
Lookup Type PostGIS Oracle MySQL [#]_ SpatiaLite PGRaster
================================= ========= ======== ============ ========== ========
:lookup:`bbcontains` X X X N
:lookup:`bboverlaps` X X X N
:lookup:`contained` X X X N
:lookup:`contains <gis-contains>` X X X X B
:lookup:`contains_properly` X B
:lookup:`coveredby` X X X B
:lookup:`covers` X X X B
:lookup:`crosses` X X X C
:lookup:`disjoint` X X X X B
:lookup:`distance_gt` X X X X N
:lookup:`distance_gte` X X X X N
:lookup:`distance_lt` X X X X N
:lookup:`distance_lte` X X X X N
:lookup:`dwithin` X X X B
:lookup:`equals` X X X X C
:lookup:`exact` X X X X B
:lookup:`intersects` X X X X B
:lookup:`isvalid` X X X (≥ 5.7.5) X (LWGEOM)
:lookup:`overlaps` X X X X B
:lookup:`relate` X X X C
:lookup:`same_as` X X X X B
:lookup:`touches` X X X X B
:lookup:`within` X X X X B
:lookup:`left` X C
:lookup:`right` X C
:lookup:`overlaps_left` X B
:lookup:`overlaps_right` X B
:lookup:`overlaps_above` X C
:lookup:`overlaps_below` X C
:lookup:`strictly_above` X C
:lookup:`strictly_below` X C
================================= ========= ======== ============ ========== ========
================================= ========= ======== ========= ============ ========== ========
Lookup Type PostGIS Oracle MariaDB MySQL [#]_ SpatiaLite PGRaster
================================= ========= ======== ========= ============ ========== ========
:lookup:`bbcontains` X X X X N
:lookup:`bboverlaps` X X X X N
:lookup:`contained` X X X X N
:lookup:`contains <gis-contains>` X X X X X B
:lookup:`contains_properly` X B
:lookup:`coveredby` X X X B
:lookup:`covers` X X X B
:lookup:`crosses` X X X X C
:lookup:`disjoint` X X X X X B
:lookup:`distance_gt` X X X X X N
:lookup:`distance_gte` X X X X X N
:lookup:`distance_lt` X X X X X N
:lookup:`distance_lte` X X X X X N
:lookup:`dwithin` X X X B
:lookup:`equals` X X X X X C
:lookup:`exact` X X X X X B
:lookup:`intersects` X X X X X B
:lookup:`isvalid` X X X (≥ 5.7.5) X (LWGEOM)
:lookup:`overlaps` X X X X X B
:lookup:`relate` X X X C
:lookup:`same_as` X X X X X B
:lookup:`touches` X X X X X B
:lookup:`within` X X X X X B
:lookup:`left` X C
:lookup:`right` X C
:lookup:`overlaps_left` X B
:lookup:`overlaps_right` X B
:lookup:`overlaps_above` X C
:lookup:`overlaps_below` X C
:lookup:`strictly_above` X C
:lookup:`strictly_below` X C
================================= ========= ======== ========= ============ ========== ========
.. _database-functions-compatibility:

View File

@ -66,7 +66,7 @@ Spatial lookups with rasters are only supported for PostGIS backends
--------------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Geometry_Contain.html>`__,
MySQL, SpatiaLite, PGRaster (Native)
MariaDB, MySQL, SpatiaLite, PGRaster (Native)
Tests if the geometry or raster field's bounding box completely contains the
lookup geometry's bounding box.
@ -79,6 +79,7 @@ Example::
Backend SQL Equivalent
========== ==========================
PostGIS ``poly ~ geom``
MariaDB ``MBRContains(poly, geom)``
MySQL ``MBRContains(poly, geom)``
SpatiaLite ``MbrContains(poly, geom)``
========== ==========================
@ -89,7 +90,7 @@ SpatiaLite ``MbrContains(poly, geom)``
--------------
*Availability*: `PostGIS <https://postgis.net/docs/geometry_overlaps.html>`__,
MySQL, SpatiaLite, PGRaster (Native)
MariaDB, MySQL, SpatiaLite, PGRaster (Native)
Tests if the geometry field's bounding box overlaps the lookup geometry's
bounding box.
@ -102,6 +103,7 @@ Example::
Backend SQL Equivalent
========== ==========================
PostGIS ``poly && geom``
MariaDB ``MBROverlaps(poly, geom)``
MySQL ``MBROverlaps(poly, geom)``
SpatiaLite ``MbrOverlaps(poly, geom)``
========== ==========================
@ -112,7 +114,7 @@ SpatiaLite ``MbrOverlaps(poly, geom)``
-------------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Geometry_Contained.html>`__,
MySQL, SpatiaLite, PGRaster (Native)
MariaDB, MySQL, SpatiaLite, PGRaster (Native)
Tests if the geometry field's bounding box is completely contained by the
lookup geometry's bounding box.
@ -125,6 +127,7 @@ Example::
Backend SQL Equivalent
========== ==========================
PostGIS ``poly @ geom``
MariaDB ``MBRWithin(poly, geom)``
MySQL ``MBRWithin(poly, geom)``
SpatiaLite ``MbrWithin(poly, geom)``
========== ==========================
@ -135,7 +138,7 @@ SpatiaLite ``MbrWithin(poly, geom)``
------------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Contains.html>`__,
Oracle, MySQL, SpatiaLite, PGRaster (Bilateral)
Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral)
Tests if the geometry field spatially contains the lookup geometry.
@ -148,6 +151,7 @@ Backend SQL Equivalent
========== ============================
PostGIS ``ST_Contains(poly, geom)``
Oracle ``SDO_CONTAINS(poly, geom)``
MariaDB ``ST_Contains(poly, geom)``
MySQL ``ST_Contains(poly, geom)``
SpatiaLite ``Contains(poly, geom)``
========== ============================
@ -230,7 +234,7 @@ SpatiaLite ``Covers(poly, geom)``
-----------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Crosses.html>`__,
MySQL, SpatiaLite, PGRaster (Conversion)
MariaDB, MySQL, SpatiaLite, PGRaster (Conversion)
Tests if the geometry field spatially crosses the lookup geometry.
@ -242,6 +246,7 @@ Example::
Backend SQL Equivalent
========== ==========================
PostGIS ``ST_Crosses(poly, geom)``
MariaDB ``ST_Crosses(poly, geom)``
MySQL ``ST_Crosses(poly, geom)``
SpatiaLite ``Crosses(poly, geom)``
========== ==========================
@ -256,7 +261,7 @@ SpatiaLite ``Crosses(poly, geom)``
------------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Disjoint.html>`__,
Oracle, MySQL, SpatiaLite, PGRaster (Bilateral)
Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral)
Tests if the geometry field is spatially disjoint from the lookup geometry.
@ -269,6 +274,7 @@ Backend SQL Equivalent
========== =================================================
PostGIS ``ST_Disjoint(poly, geom)``
Oracle ``SDO_GEOM.RELATE(poly, 'DISJOINT', geom, 0.05)``
MariaDB ``ST_Disjoint(poly, geom)``
MySQL ``ST_Disjoint(poly, geom)``
SpatiaLite ``Disjoint(poly, geom)``
========== =================================================
@ -284,7 +290,7 @@ SpatiaLite ``Disjoint(poly, geom)``
----------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Equals.html>`__,
Oracle, MySQL, SpatiaLite, PGRaster (Conversion)
Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Conversion)
Tests if the geometry field is spatially equal to the lookup geometry.
@ -297,6 +303,7 @@ Backend SQL Equivalent
========== =================================================
PostGIS ``ST_Equals(poly, geom)``
Oracle ``SDO_EQUAL(poly, geom)``
MariaDB ``ST_Equals(poly, geom)``
MySQL ``ST_Equals(poly, geom)``
SpatiaLite ``Equals(poly, geom)``
========== =================================================
@ -313,7 +320,7 @@ SpatiaLite ``Equals(poly, geom)``
----------------------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Geometry_Same.html>`__,
Oracle, MySQL, SpatiaLite, PGRaster (Bilateral)
Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral)
Tests if the geometry field is "equal" to the lookup geometry. On Oracle,
MySQL, and SpatiaLite, it tests spatial equality, while on PostGIS it tests
@ -328,6 +335,7 @@ Backend SQL Equivalent
========== =================================================
PostGIS ``poly ~= geom``
Oracle ``SDO_EQUAL(poly, geom)``
MariaDB ``ST_Equals(poly, geom)``
MySQL ``ST_Equals(poly, geom)``
SpatiaLite ``Equals(poly, geom)``
========== =================================================
@ -343,7 +351,7 @@ SpatiaLite ``Equals(poly, geom)``
--------------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Intersects.html>`__,
Oracle, MySQL, SpatiaLite, PGRaster (Bilateral)
Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral)
Tests if the geometry field spatially intersects the lookup geometry.
@ -356,6 +364,7 @@ Backend SQL Equivalent
========== =================================================
PostGIS ``ST_Intersects(poly, geom)``
Oracle ``SDO_OVERLAPBDYINTERSECT(poly, geom)``
MariaDB ``ST_Intersects(poly, geom)``
MySQL ``ST_Intersects(poly, geom)``
SpatiaLite ``Intersects(poly, geom)``
========== =================================================
@ -392,7 +401,7 @@ Oracle ``SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(poly, 0.05
------------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Overlaps.html>`__,
Oracle, MySQL, SpatiaLite, PGRaster (Bilateral)
Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral)
Tests if the geometry field spatially overlaps the lookup geometry.
@ -401,6 +410,7 @@ Backend SQL Equivalent
========== ============================
PostGIS ``ST_Overlaps(poly, geom)``
Oracle ``SDO_OVERLAPS(poly, geom)``
MariaDB ``ST_Overlaps(poly, geom)``
MySQL ``ST_Overlaps(poly, geom)``
SpatiaLite ``Overlaps(poly, geom)``
========== ============================
@ -487,7 +497,7 @@ Oracle SQL equivalent:
-----------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Touches.html>`__,
Oracle, MySQL, SpatiaLite
Oracle, MariaDB, MySQL, SpatiaLite
Tests if the geometry field spatially touches the lookup geometry.
@ -499,6 +509,7 @@ Example::
Backend SQL Equivalent
========== ==========================
PostGIS ``ST_Touches(poly, geom)``
MariaDB ``ST_Touches(poly, geom)``
MySQL ``ST_Touches(poly, geom)``
Oracle ``SDO_TOUCH(poly, geom)``
SpatiaLite ``Touches(poly, geom)``
@ -515,7 +526,7 @@ SpatiaLite ``Touches(poly, geom)``
----------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Within.html>`__,
Oracle, MySQL, SpatiaLite, PGRaster (Bilateral)
Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral)
Tests if the geometry field is spatially within the lookup geometry.
@ -527,6 +538,7 @@ Example::
Backend SQL Equivalent
========== ==========================
PostGIS ``ST_Within(poly, geom)``
MariaDB ``ST_Within(poly, geom)``
MySQL ``ST_Within(poly, geom)``
Oracle ``SDO_INSIDE(poly, geom)``
SpatiaLite ``Within(poly, geom)``
@ -712,7 +724,7 @@ PostGIS equivalent:
Distance Lookups
================
*Availability*: PostGIS, Oracle, MySQL, SpatiaLite, PGRaster (Native)
*Availability*: PostGIS, Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Native)
For an overview on performing distance queries, please refer to
the :ref:`distance queries introduction <distance-queries>`.
@ -757,6 +769,7 @@ Example::
Backend SQL Equivalent
========== ==================================================
PostGIS ``ST_Distance/ST_Distance_Sphere(poly, geom) > 5``
MariaDB ``ST_Distance(poly, geom) > 5``
MySQL ``ST_Distance(poly, geom) > 5``
Oracle ``SDO_GEOM.SDO_DISTANCE(poly, geom, 0.05) > 5``
SpatiaLite ``Distance(poly, geom) > 5``
@ -778,6 +791,7 @@ Example::
Backend SQL Equivalent
========== ===================================================
PostGIS ``ST_Distance/ST_Distance_Sphere(poly, geom) >= 5``
MariaDB ``ST_Distance(poly, geom) >= 5``
MySQL ``ST_Distance(poly, geom) >= 5``
Oracle ``SDO_GEOM.SDO_DISTANCE(poly, geom, 0.05) >= 5``
SpatiaLite ``Distance(poly, geom) >= 5``
@ -799,6 +813,7 @@ Example::
Backend SQL Equivalent
========== ==================================================
PostGIS ``ST_Distance/ST_Distance_Sphere(poly, geom) < 5``
MariaDB ``ST_Distance(poly, geom) < 5``
MySQL ``ST_Distance(poly, geom) < 5``
Oracle ``SDO_GEOM.SDO_DISTANCE(poly, geom, 0.05) < 5``
SpatiaLite ``Distance(poly, geom) < 5``
@ -820,6 +835,7 @@ Example::
Backend SQL Equivalent
========== ===================================================
PostGIS ``ST_Distance/ST_Distance_Sphere(poly, geom) <= 5``
MariaDB ``ST_Distance(poly, geom) <= 5``
MySQL ``ST_Distance(poly, geom) <= 5``
Oracle ``SDO_GEOM.SDO_DISTANCE(poly, geom, 0.05) <= 5``
SpatiaLite ``Distance(poly, geom) <= 5``