0
0
mirror of https://github.com/django/django.git synced 2024-11-21 19:09:18 +01:00

Refs #35803 -- Added support for __covers GIS lookup on MySQL.

This commit is contained in:
Mariusz Felisiak 2024-09-29 19:46:26 +02:00 committed by Sarah Boyce
parent c77573716a
commit 5cf88dcc57
4 changed files with 10 additions and 3 deletions

View File

@ -60,6 +60,8 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
operators["relate"] = SpatialOperator(func="ST_Relate")
if self.connection.mysql_version < (11, 7):
del operators["coveredby"]
else:
operators["covers"] = SpatialOperator(func="MBRCovers")
return operators
@cached_property

View File

@ -348,7 +348,7 @@ Lookup Type PostGIS Oracle MariaDB MySQL [#]_ S
:lookup:`contains <gis-contains>` X X X X X B
:lookup:`contains_properly` X B
:lookup:`coveredby` X X X (≥ 11.7) X X B
:lookup:`covers` X X X B
:lookup:`covers` X 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

View File

@ -212,7 +212,7 @@ SpatiaLite ``CoveredBy(poly, geom)``
----------
*Availability*: `PostGIS <https://postgis.net/docs/ST_Covers.html>`__,
Oracle, PGRaster (Bilateral), SpatiaLite
Oracle, MySQL, PGRaster (Bilateral), SpatiaLite
Tests if no point in the lookup geometry is outside the geometry field.
[#fncovers]_
@ -226,9 +226,14 @@ Backend SQL Equivalent
========== ==========================
PostGIS ``ST_Covers(poly, geom)``
Oracle ``SDO_COVERS(poly, geom)``
MySQL ``MBRCovers(poly, geom)``
SpatiaLite ``Covers(poly, geom)``
========== ==========================
.. versionchanged:: 5.2
MySQL support was added.
.. fieldlookup:: crosses
``crosses``

View File

@ -100,7 +100,7 @@ Minor features
:meth:`.OGRGeometry.get_linear_geometry` and
:meth:`.OGRGeometry.get_curve_geometry` methods.
* :lookup:`coveredby` lookup is now supported on MySQL.
* :lookup:`coveredby` and :lookup:`covers` lookup are now supported on MySQL.
* :lookup:`coveredby` and :lookup:`isvalid` lookups,
:class:`~django.contrib.gis.db.models.Collect` aggregation, and