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
4bc35507
Kaydet (Commit)
4bc35507
authored
Mar 29, 2017
tarafından
Sergey Fedoseev
Kaydeden (comit)
Tim Graham
Mar 29, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27973 -- Fixed GeoJSON representation of LinearRing and custom GEOSGeometry subclasses.
üst
9cd6ba99
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
1 deletion
+18
-1
collections.py
django/contrib/gis/geos/collections.py
+4
-0
geometry.py
django/contrib/gis/geos/geometry.py
+1
-1
linestring.py
django/contrib/gis/geos/linestring.py
+1
-0
point.py
django/contrib/gis/geos/point.py
+1
-0
polygon.py
django/contrib/gis/geos/polygon.py
+1
-0
test_geos.py
tests/gis_tests/geos_tests/test_geos.py
+10
-0
No files found.
django/contrib/gis/geos/collections.py
Dosyayı görüntüle @
4bc35507
...
...
@@ -15,6 +15,7 @@ from django.contrib.gis.geos.polygon import Polygon
class
GeometryCollection
(
GEOSGeometry
):
_json_type
=
'GeometryCollection'
_typeid
=
7
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -106,11 +107,13 @@ class GeometryCollection(GEOSGeometry):
# MultiPoint, MultiLineString, and MultiPolygon class definitions.
class
MultiPoint
(
GeometryCollection
):
_allowed
=
Point
_json_type
=
'MultiPoint'
_typeid
=
4
class
MultiLineString
(
LinearGeometryMixin
,
GeometryCollection
):
_allowed
=
(
LineString
,
LinearRing
)
_json_type
=
'MultiLineString'
_typeid
=
5
@property
...
...
@@ -122,6 +125,7 @@ class MultiLineString(LinearGeometryMixin, GeometryCollection):
class
MultiPolygon
(
GeometryCollection
):
_allowed
=
Polygon
_json_type
=
'MultiPolygon'
_typeid
=
6
...
...
django/contrib/gis/geos/geometry.py
Dosyayı görüntüle @
4bc35507
...
...
@@ -415,7 +415,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
"""
Return GeoJSON representation of this Geometry.
"""
return
json
.
dumps
({
'type'
:
self
.
_
_class__
.
__name__
,
'coordinates'
:
self
.
coords
})
return
json
.
dumps
({
'type'
:
self
.
_
json_type
,
'coordinates'
:
self
.
coords
})
geojson
=
json
@property
...
...
django/contrib/gis/geos/linestring.py
Dosyayı görüntüle @
4bc35507
...
...
@@ -8,6 +8,7 @@ from django.contrib.gis.shortcuts import numpy
class
LineString
(
LinearGeometryMixin
,
GEOSGeometry
):
_init_func
=
capi
.
create_linestring
_json_type
=
'LineString'
_minlength
=
2
has_cs
=
True
...
...
django/contrib/gis/geos/point.py
Dosyayı görüntüle @
4bc35507
...
...
@@ -7,6 +7,7 @@ from django.contrib.gis.geos.geometry import GEOSGeometry
class
Point
(
GEOSGeometry
):
_json_type
=
'Point'
_minlength
=
2
_maxlength
=
3
has_cs
=
True
...
...
django/contrib/gis/geos/polygon.py
Dosyayı görüntüle @
4bc35507
...
...
@@ -7,6 +7,7 @@ from django.contrib.gis.geos.linestring import LinearRing
class
Polygon
(
GEOSGeometry
):
_json_type
=
'Polygon'
_minlength
=
1
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
tests/gis_tests/geos_tests/test_geos.py
Dosyayı görüntüle @
4bc35507
...
...
@@ -372,6 +372,12 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
with
self
.
assertRaisesMessage
(
ValueError
,
'LinearRing requires at least 4 points, got 1.'
):
LinearRing
(
numpy
.
array
([(
0
,
0
)]))
def
test_linearring_json
(
self
):
self
.
assertJSONEqual
(
LinearRing
((
0
,
0
),
(
0
,
1
),
(
1
,
1
),
(
0
,
0
))
.
json
,
'{"coordinates": [[0, 0], [0, 1], [1, 1], [0, 0]], "type": "LineString"}'
,
)
def
test_polygons_from_bbox
(
self
):
"Testing `from_bbox` class method."
bbox
=
(
-
180
,
-
90
,
180
,
90
)
...
...
@@ -1269,6 +1275,10 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
self
.
assertEqual
(
type
(
ext_poly
),
ExtendedPolygon
)
# ExtendedPolygon.__str__ should be called (instead of Polygon.__str__).
self
.
assertEqual
(
str
(
ext_poly
),
"EXT_POLYGON - data: 3 - POLYGON ((0 0, 0 1, 1 1, 0 0))"
)
self
.
assertJSONEqual
(
ext_poly
.
json
,
'{"coordinates": [[[0, 0], [0, 1], [1, 1], [0, 0]]], "type": "Polygon"}'
,
)
def
test_geos_version
(
self
):
"""Testing the GEOS version regular expression."""
...
...
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