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
8ba44ecd
Kaydet (Commit)
8ba44ecd
authored
Haz 18, 2016
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26775 -- Supported dim=3 geography fields
Thanks François-Xavier Thomas for the report.
üst
b45852c2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
operations.py
django/contrib/gis/db/backends/postgis/operations.py
+6
-5
models.py
tests/gis_tests/geo3d/models.py
+1
-0
tests.py
tests/gis_tests/geo3d/tests.py
+7
-3
No files found.
django/contrib/gis/db/backends/postgis/operations.py
Dosyayı görüntüle @
8ba44ecd
...
...
@@ -268,18 +268,19 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
"""
if
f
.
geom_type
==
'RASTER'
:
return
'raster'
elif
f
.
geography
:
if
f
.
srid
!=
4326
:
raise
NotImplementedError
(
'PostGIS only supports geography columns with an SRID of 4326.'
)
return
'geography(
%
s,
%
d)'
%
(
f
.
geom_type
,
f
.
srid
)
else
:
# Type-based geometries.
# TODO: Support 'M' extension.
if
f
.
dim
==
3
:
geom_type
=
f
.
geom_type
+
'Z'
else
:
geom_type
=
f
.
geom_type
if
f
.
geography
:
if
f
.
srid
!=
4326
:
raise
NotImplementedError
(
'PostGIS only supports geography columns with an SRID of 4326.'
)
return
'geography(
%
s,
%
d)'
%
(
geom_type
,
f
.
srid
)
else
:
return
'geometry(
%
s,
%
d)'
%
(
geom_type
,
f
.
srid
)
def
get_distance
(
self
,
f
,
dist_val
,
lookup_type
,
handle_spheroid
=
True
):
...
...
tests/gis_tests/geo3d/models.py
Dosyayı görüntüle @
8ba44ecd
...
...
@@ -19,6 +19,7 @@ class NamedModel(models.Model):
class
City3D
(
NamedModel
):
point
=
models
.
PointField
(
dim
=
3
)
pointg
=
models
.
PointField
(
dim
=
3
,
geography
=
True
)
class
Interstate2D
(
NamedModel
):
...
...
tests/gis_tests/geo3d/tests.py
Dosyayı görüntüle @
8ba44ecd
...
...
@@ -85,7 +85,9 @@ class Geo3DLoadingHelper(object):
def
_load_city_data
(
self
):
for
name
,
pnt_data
in
city_data
:
City3D
.
objects
.
create
(
name
=
name
,
point
=
Point
(
*
pnt_data
,
srid
=
4326
))
City3D
.
objects
.
create
(
name
=
name
,
point
=
Point
(
*
pnt_data
,
srid
=
4326
),
pointg
=
Point
(
*
pnt_data
,
srid
=
4326
),
)
def
_load_polygon_data
(
self
):
bbox_wkt
,
bbox_z
=
bbox_data
...
...
@@ -122,9 +124,11 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
self
.
_load_city_data
()
for
name
,
pnt_data
in
city_data
:
city
=
City3D
.
objects
.
get
(
name
=
name
)
z
=
pnt_data
[
2
]
# Testing both geometry and geography fields
self
.
assertTrue
(
city
.
point
.
hasz
)
self
.
assertEqual
(
z
,
city
.
point
.
z
)
self
.
assertTrue
(
city
.
pointg
.
hasz
)
self
.
assertEqual
(
city
.
point
.
z
,
pnt_data
[
2
])
self
.
assertEqual
(
city
.
pointg
.
z
,
pnt_data
[
2
])
def
test_3d_polygons
(
self
):
"""
...
...
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