mirror of https://github.com/django/django.git
Fixed #26685 -- Added dwithin lookup support on SpatiaLite.
This commit is contained in:
parent
0d7929266e
commit
35504f74a8
|
@ -58,6 +58,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
|||
gis_operators = {
|
||||
'equals': SpatialOperator(func='Equals'),
|
||||
'disjoint': SpatialOperator(func='Disjoint'),
|
||||
'dwithin': SpatialOperator(func='PtDistWithin'),
|
||||
'touches': SpatialOperator(func='Touches'),
|
||||
'crosses': SpatialOperator(func='Crosses'),
|
||||
'within': SpatialOperator(func='Within'),
|
||||
|
|
|
@ -343,7 +343,7 @@ Lookup Type PostGIS Oracle MySQL [#]_ SpatiaLite
|
|||
:lookup:`distance_gte` X X X N
|
||||
:lookup:`distance_lt` X X X N
|
||||
:lookup:`distance_lte` X X X N
|
||||
:lookup:`dwithin` X X B
|
||||
: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
|
||||
|
|
|
@ -708,11 +708,12 @@ Backend SQL Equivalent
|
|||
========== ======================================
|
||||
PostGIS ``ST_DWithin(poly, geom, 5)``
|
||||
Oracle ``SDO_WITHIN_DISTANCE(poly, geom, 5)``
|
||||
SpatiaLite ``PtDistWithin(poly, geom, 5)``
|
||||
========== ======================================
|
||||
|
||||
.. note::
|
||||
.. versionchanged:: 1.11
|
||||
|
||||
This lookup is not available on SpatiaLite.
|
||||
SpatiaLite support was added.
|
||||
|
||||
.. _geoqueryset-methods:
|
||||
|
||||
|
|
|
@ -114,6 +114,8 @@ Minor features
|
|||
* The new :meth:`.GEOSGeometry.from_gml` and :meth:`.OGRGeometry.from_gml`
|
||||
methods allow creating geometries from GML.
|
||||
|
||||
* Added support for the :lookup:`dwithin` lookup on SpatiaLite.
|
||||
|
||||
:mod:`django.contrib.messages`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ from django.db.models import F, Q
|
|||
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from ..utils import no_oracle, oracle, postgis
|
||||
from ..utils import no_oracle, oracle, postgis, spatialite
|
||||
from .models import (
|
||||
AustraliaCity, CensusZipcode, Interstate, SouthTexasCity, SouthTexasCityFt,
|
||||
SouthTexasInterstate, SouthTexasZipcode,
|
||||
|
@ -82,9 +82,11 @@ class DistanceTest(TestCase):
|
|||
type_error = False
|
||||
|
||||
if isinstance(dist, tuple):
|
||||
if oracle:
|
||||
if oracle or spatialite:
|
||||
# Result in meters
|
||||
dist = dist[1]
|
||||
else:
|
||||
# Result in units of the field
|
||||
dist = dist[0]
|
||||
|
||||
# Creating the query set.
|
||||
|
|
Loading…
Reference in New Issue