From 336c9cb7f44b3b8a2d575c222e681d78dee6edd2 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 16 Oct 2019 13:16:30 +0200 Subject: [PATCH] [3.0.x] Fixed #30562 -- Doc'd MariaDB support for GIS spatial lookups. Backport of 1c5ec221a44fc9ce1585fc1f94830957df4322e7 from master --- docs/ref/contrib/gis/db-api.txt | 74 +++++++++++++-------------- docs/ref/contrib/gis/geoquerysets.txt | 42 ++++++++++----- 2 files changed, 66 insertions(+), 50 deletions(-) diff --git a/docs/ref/contrib/gis/db-api.txt b/docs/ref/contrib/gis/db-api.txt index 88c2676eb4..ad896f3e5d 100644 --- a/docs/ref/contrib/gis/db-api.txt +++ b/docs/ref/contrib/gis/db-api.txt @@ -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 `: 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 ` 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 ` 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: diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt index 6b1b888f6a..090f283075 100644 --- a/docs/ref/contrib/gis/geoquerysets.txt +++ b/docs/ref/contrib/gis/geoquerysets.txt @@ -66,7 +66,7 @@ Spatial lookups with rasters are only supported for PostGIS backends -------------- *Availability*: `PostGIS `__, -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 `__, -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 `__, -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 `__, -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)`` ========== ============================ @@ -238,7 +242,7 @@ SpatiaLite ``Covers(poly, geom)`` ----------- *Availability*: `PostGIS `__, -MySQL, SpatiaLite, PGRaster (Conversion) +MariaDB, MySQL, SpatiaLite, PGRaster (Conversion) Tests if the geometry field spatially crosses the lookup geometry. @@ -250,6 +254,7 @@ Example:: Backend SQL Equivalent ========== ========================== PostGIS ``ST_Crosses(poly, geom)`` +MariaDB ``ST_Crosses(poly, geom)`` MySQL ``ST_Crosses(poly, geom)`` SpatiaLite ``Crosses(poly, geom)`` ========== ========================== @@ -264,7 +269,7 @@ SpatiaLite ``Crosses(poly, geom)`` ------------ *Availability*: `PostGIS `__, -Oracle, MySQL, SpatiaLite, PGRaster (Bilateral) +Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral) Tests if the geometry field is spatially disjoint from the lookup geometry. @@ -277,6 +282,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)`` ========== ================================================= @@ -292,7 +298,7 @@ SpatiaLite ``Disjoint(poly, geom)`` ---------- *Availability*: `PostGIS `__, -Oracle, MySQL, SpatiaLite, PGRaster (Conversion) +Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Conversion) Tests if the geometry field is spatially equal to the lookup geometry. @@ -305,6 +311,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)`` ========== ================================================= @@ -321,7 +328,7 @@ SpatiaLite ``Equals(poly, geom)`` ---------------------- *Availability*: `PostGIS `__, -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 @@ -336,6 +343,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)`` ========== ================================================= @@ -351,7 +359,7 @@ SpatiaLite ``Equals(poly, geom)`` -------------- *Availability*: `PostGIS `__, -Oracle, MySQL, SpatiaLite, PGRaster (Bilateral) +Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral) Tests if the geometry field spatially intersects the lookup geometry. @@ -364,6 +372,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)`` ========== ================================================= @@ -400,7 +409,7 @@ Oracle ``SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(poly, 0.05 ------------ *Availability*: `PostGIS `__, -Oracle, MySQL, SpatiaLite, PGRaster (Bilateral) +Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral) Tests if the geometry field spatially overlaps the lookup geometry. @@ -409,6 +418,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)`` ========== ============================ @@ -495,7 +505,7 @@ Oracle SQL equivalent: ----------- *Availability*: `PostGIS `__, -Oracle, MySQL, SpatiaLite +Oracle, MariaDB, MySQL, SpatiaLite Tests if the geometry field spatially touches the lookup geometry. @@ -507,6 +517,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)`` @@ -523,7 +534,7 @@ SpatiaLite ``Touches(poly, geom)`` ---------- *Availability*: `PostGIS `__, -Oracle, MySQL, SpatiaLite, PGRaster (Bilateral) +Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Bilateral) Tests if the geometry field is spatially within the lookup geometry. @@ -535,6 +546,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)`` @@ -720,7 +732,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 `. @@ -765,6 +777,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`` @@ -786,6 +799,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`` @@ -807,6 +821,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`` @@ -828,6 +843,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``