mirror of https://github.com/django/django.git
Fixed #29509 -- Added SpatiaLite support for covers and coveredby lookups.
This commit is contained in:
parent
12018cef83
commit
a799dc51b9
|
@ -47,6 +47,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
|||
'contains': SpatialiteNullCheckOperator(func='Contains'),
|
||||
'intersects': SpatialiteNullCheckOperator(func='Intersects'),
|
||||
'relate': SpatialiteNullCheckOperator(func='Relate'),
|
||||
'coveredby': SpatialiteNullCheckOperator(func='CoveredBy'),
|
||||
'covers': SpatialiteNullCheckOperator(func='Covers'),
|
||||
# Returns true if B's bounding box completely contains A's bounding box.
|
||||
'contained': SpatialOperator(func='MbrWithin'),
|
||||
# Returns true if A's bounding box completely contains B's bounding box.
|
||||
|
|
|
@ -329,8 +329,8 @@ Lookup Type PostGIS Oracle MySQL [#]_ SpatiaLite
|
|||
:lookup:`contained` X X X N
|
||||
:lookup:`contains <gis-contains>` X X X X B
|
||||
:lookup:`contains_properly` X B
|
||||
:lookup:`coveredby` X X B
|
||||
:lookup:`covers` X X B
|
||||
:lookup:`coveredby` X X X B
|
||||
:lookup:`covers` X X X B
|
||||
:lookup:`crosses` X X C
|
||||
:lookup:`disjoint` X X X X B
|
||||
:lookup:`distance_gt` X X X N
|
||||
|
|
|
@ -179,7 +179,7 @@ PostGIS ``ST_ContainsProperly(poly, geom)``
|
|||
-------------
|
||||
|
||||
*Availability*: `PostGIS <https://postgis.net/docs/ST_CoveredBy.html>`__,
|
||||
Oracle, PGRaster (Bilateral)
|
||||
Oracle, PGRaster (Bilateral), SpatiaLite
|
||||
|
||||
Tests if no point in the geometry field is outside the lookup geometry.
|
||||
[#fncovers]_
|
||||
|
@ -188,11 +188,16 @@ Example::
|
|||
|
||||
Zipcode.objects.filter(poly__coveredby=geom)
|
||||
|
||||
.. versionchanged:: 2.2
|
||||
|
||||
SpatiaLite support was added.
|
||||
|
||||
========== =============================
|
||||
Backend SQL Equivalent
|
||||
========== =============================
|
||||
PostGIS ``ST_CoveredBy(poly, geom)``
|
||||
Oracle ``SDO_COVEREDBY(poly, geom)``
|
||||
SpatiaLite ``CoveredBy(poly, geom)``
|
||||
========== =============================
|
||||
|
||||
.. fieldlookup:: covers
|
||||
|
@ -201,7 +206,7 @@ Oracle ``SDO_COVEREDBY(poly, geom)``
|
|||
----------
|
||||
|
||||
*Availability*: `PostGIS <https://postgis.net/docs/ST_Covers.html>`__,
|
||||
Oracle, PGRaster (Bilateral)
|
||||
Oracle, PGRaster (Bilateral), SpatiaLite
|
||||
|
||||
Tests if no point in the lookup geometry is outside the geometry field.
|
||||
[#fncovers]_
|
||||
|
@ -210,11 +215,16 @@ Example::
|
|||
|
||||
Zipcode.objects.filter(poly__covers=geom)
|
||||
|
||||
.. versionchanged:: 2.2
|
||||
|
||||
SpatiaLite support was added.
|
||||
|
||||
========== ==========================
|
||||
Backend SQL Equivalent
|
||||
========== ==========================
|
||||
PostGIS ``ST_Covers(poly, geom)``
|
||||
Oracle ``SDO_COVERS(poly, geom)``
|
||||
SpatiaLite ``Covers(poly, geom)``
|
||||
========== ==========================
|
||||
|
||||
.. fieldlookup:: crosses
|
||||
|
|
|
@ -59,6 +59,9 @@ Minor features
|
|||
* Added Oracle support for the
|
||||
:class:`~django.contrib.gis.db.models.functions.Envelope` function.
|
||||
|
||||
* Added SpatiaLite support for the :lookup:`coveredby` and :lookup:`covers`
|
||||
lookups.
|
||||
|
||||
:mod:`django.contrib.messages`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -421,6 +421,8 @@ class GeoLookupTest(TestCase):
|
|||
('relate', (Point(1, 1), 'T*T***FF*')),
|
||||
('same_as', Point(1, 1)),
|
||||
('exact', Point(1, 1)),
|
||||
('coveredby', Point(1, 1)),
|
||||
('covers', Point(1, 1)),
|
||||
]
|
||||
for lookup, geom in queries:
|
||||
with self.subTest(lookup=lookup):
|
||||
|
|
Loading…
Reference in New Issue