Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
da0fb5b1
Kaydet (Commit)
da0fb5b1
authored
Tem 10, 2017
tarafından
Fabian Schindler
Kaydeden (comit)
Tim Graham
Agu 24, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28380 -- Excluded null geometries in SpatiaLite geometry lookups.
üst
a8bb4935
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
11 deletions
+38
-11
operations.py
django/contrib/gis/db/backends/spatialite/operations.py
+17
-11
tests.py
tests/gis_tests/geoapp/tests.py
+21
-0
No files found.
django/contrib/gis/db/backends/spatialite/operations.py
Dosyayı görüntüle @
da0fb5b1
...
...
@@ -17,6 +17,12 @@ from django.utils.functional import cached_property
from
django.utils.version
import
get_version_tuple
class
SpatialiteNullCheckOperator
(
SpatialOperator
):
def
as_sql
(
self
,
connection
,
lookup
,
template_params
,
sql_params
):
sql
,
params
=
super
()
.
as_sql
(
connection
,
lookup
,
template_params
,
sql_params
)
return
'
%
s > 0'
%
sql
,
params
class
SpatiaLiteOperations
(
BaseSpatialOperations
,
DatabaseOperations
):
name
=
'spatialite'
spatialite
=
True
...
...
@@ -33,15 +39,15 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
gis_operators
=
{
# Binary predicates
'equals'
:
SpatialOperator
(
func
=
'Equals'
),
'disjoint'
:
SpatialOperator
(
func
=
'Disjoint'
),
'touches'
:
SpatialOperator
(
func
=
'Touches'
),
'crosses'
:
SpatialOperator
(
func
=
'Crosses'
),
'within'
:
SpatialOperator
(
func
=
'Within'
),
'overlaps'
:
SpatialOperator
(
func
=
'Overlaps'
),
'contains'
:
SpatialOperator
(
func
=
'Contains'
),
'intersects'
:
SpatialOperator
(
func
=
'Intersects'
),
'relate'
:
SpatialOperator
(
func
=
'Relate'
),
'equals'
:
Spatial
iteNullCheck
Operator
(
func
=
'Equals'
),
'disjoint'
:
Spatial
iteNullCheck
Operator
(
func
=
'Disjoint'
),
'touches'
:
Spatial
iteNullCheck
Operator
(
func
=
'Touches'
),
'crosses'
:
Spatial
iteNullCheck
Operator
(
func
=
'Crosses'
),
'within'
:
Spatial
iteNullCheck
Operator
(
func
=
'Within'
),
'overlaps'
:
Spatial
iteNullCheck
Operator
(
func
=
'Overlaps'
),
'contains'
:
Spatial
iteNullCheck
Operator
(
func
=
'Contains'
),
'intersects'
:
Spatial
iteNullCheck
Operator
(
func
=
'Intersects'
),
'relate'
:
Spatial
iteNullCheck
Operator
(
func
=
'Relate'
),
# 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.
...
...
@@ -49,8 +55,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
# Returns true if A's bounding box overlaps B's bounding box.
'bboverlaps'
:
SpatialOperator
(
func
=
'MbrOverlaps'
),
# These are implemented here as synonyms for Equals
'same_as'
:
SpatialOperator
(
func
=
'Equals'
),
'exact'
:
SpatialOperator
(
func
=
'Equals'
),
'same_as'
:
Spatial
iteNullCheck
Operator
(
func
=
'Equals'
),
'exact'
:
Spatial
iteNullCheck
Operator
(
func
=
'Equals'
),
# Distance predicates
'dwithin'
:
SpatialOperator
(
func
=
'PtDistWithin'
),
}
...
...
tests/gis_tests/geoapp/tests.py
Dosyayı görüntüle @
da0fb5b1
...
...
@@ -403,6 +403,27 @@ class GeoLookupTest(TestCase):
State
.
objects
.
filter
(
name
=
'Northern Mariana Islands'
)
.
update
(
poly
=
None
)
self
.
assertIsNone
(
State
.
objects
.
get
(
name
=
'Northern Mariana Islands'
)
.
poly
)
@skipUnlessDBFeature
(
'supports_null_geometries'
,
'supports_crosses_lookup'
,
'supports_relate_lookup'
)
def
test_null_geometries_excluded_in_lookups
(
self
):
"""NULL features are excluded in spatial lookup functions."""
null
=
State
.
objects
.
create
(
name
=
'NULL'
,
poly
=
None
)
queries
=
[
(
'equals'
,
Point
(
1
,
1
)),
(
'disjoint'
,
Point
(
1
,
1
)),
(
'touches'
,
Point
(
1
,
1
)),
(
'crosses'
,
LineString
((
0
,
0
),
(
1
,
1
),
(
5
,
5
))),
(
'within'
,
Point
(
1
,
1
)),
(
'overlaps'
,
LineString
((
0
,
0
),
(
1
,
1
),
(
5
,
5
))),
(
'contains'
,
LineString
((
0
,
0
),
(
1
,
1
),
(
5
,
5
))),
(
'intersects'
,
LineString
((
0
,
0
),
(
1
,
1
),
(
5
,
5
))),
(
'relate'
,
(
Point
(
1
,
1
),
'T*T***FF*'
)),
(
'same_as'
,
Point
(
1
,
1
)),
(
'exact'
,
Point
(
1
,
1
)),
]
for
lookup
,
geom
in
queries
:
with
self
.
subTest
(
lookup
=
lookup
):
self
.
assertNotIn
(
null
,
State
.
objects
.
filter
(
**
{
'poly__
%
s'
%
lookup
:
geom
}))
@skipUnlessDBFeature
(
"supports_relate_lookup"
)
def
test_relate_lookup
(
self
):
"Testing the 'relate' lookup type."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment