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
5a23cc00
Kaydet (Commit)
5a23cc00
authored
Ara 15, 2016
tarafından
Sergey Fedoseev
Kaydeden (comit)
Tim Graham
Ara 15, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27607 -- Added Oracle support for AsGML GIS function.
üst
d2a26c1a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
17 deletions
+26
-17
operations.py
django/contrib/gis/db/backends/oracle/operations.py
+1
-2
functions.py
django/contrib/gis/db/models/functions.py
+10
-2
db-api.txt
docs/ref/contrib/gis/db-api.txt
+1
-1
functions.txt
docs/ref/contrib/gis/functions.txt
+6
-2
1.11.txt
docs/releases/1.11.txt
+2
-1
test_functions.py
tests/gis_tests/geoapp/test_functions.py
+6
-9
No files found.
django/contrib/gis/db/backends/oracle/operations.py
Dosyayı görüntüle @
5a23cc00
...
@@ -132,8 +132,7 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
...
@@ -132,8 +132,7 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
truncate_params
=
{
'relate'
:
None
}
truncate_params
=
{
'relate'
:
None
}
unsupported_functions
=
{
unsupported_functions
=
{
'AsGeoJSON'
,
'AsGML'
,
'AsKML'
,
'AsSVG'
,
'AsGeoJSON'
,
'AsKML'
,
'AsSVG'
,
'BoundingCircle'
,
'Envelope'
,
'BoundingCircle'
,
'Envelope'
,
'ForceRHR'
,
'GeoHash'
,
'MakeValid'
,
'MemSize'
,
'Scale'
,
'ForceRHR'
,
'GeoHash'
,
'MakeValid'
,
'MemSize'
,
'Scale'
,
'SnapToGrid'
,
'Translate'
,
'SnapToGrid'
,
'Translate'
,
}
}
...
...
django/contrib/gis/db/models/functions.py
Dosyayı görüntüle @
5a23cc00
...
@@ -38,12 +38,12 @@ class GeoFunc(Func):
...
@@ -38,12 +38,12 @@ class GeoFunc(Func):
except
(
AttributeError
,
FieldError
):
except
(
AttributeError
,
FieldError
):
return
None
return
None
def
as_sql
(
self
,
compiler
,
connection
):
def
as_sql
(
self
,
compiler
,
connection
,
**
extra_context
):
if
self
.
function
is
None
:
if
self
.
function
is
None
:
self
.
function
=
connection
.
ops
.
spatial_function_name
(
self
.
name
)
self
.
function
=
connection
.
ops
.
spatial_function_name
(
self
.
name
)
if
any
(
isinstance
(
field
,
RasterField
)
for
field
in
self
.
get_source_fields
()):
if
any
(
isinstance
(
field
,
RasterField
)
for
field
in
self
.
get_source_fields
()):
raise
TypeError
(
"Geometry functions not supported for raster fields."
)
raise
TypeError
(
"Geometry functions not supported for raster fields."
)
return
super
(
GeoFunc
,
self
)
.
as_sql
(
compiler
,
connection
)
return
super
(
GeoFunc
,
self
)
.
as_sql
(
compiler
,
connection
,
**
extra_context
)
def
resolve_expression
(
self
,
*
args
,
**
kwargs
):
def
resolve_expression
(
self
,
*
args
,
**
kwargs
):
res
=
super
(
GeoFunc
,
self
)
.
resolve_expression
(
*
args
,
**
kwargs
)
res
=
super
(
GeoFunc
,
self
)
.
resolve_expression
(
*
args
,
**
kwargs
)
...
@@ -172,6 +172,14 @@ class AsGML(GeoFunc):
...
@@ -172,6 +172,14 @@ class AsGML(GeoFunc):
expressions
.
append
(
self
.
_handle_param
(
precision
,
'precision'
,
six
.
integer_types
))
expressions
.
append
(
self
.
_handle_param
(
precision
,
'precision'
,
six
.
integer_types
))
super
(
AsGML
,
self
)
.
__init__
(
*
expressions
,
**
extra
)
super
(
AsGML
,
self
)
.
__init__
(
*
expressions
,
**
extra
)
def
as_oracle
(
self
,
compiler
,
connection
,
**
extra_context
):
source_expressions
=
self
.
get_source_expressions
()
version
=
source_expressions
[
0
]
clone
=
self
.
copy
()
clone
.
set_source_expressions
([
source_expressions
[
1
]])
extra_context
[
'function'
]
=
'SDO_UTIL.TO_GML311GEOMETRY'
if
version
.
value
==
3
else
'SDO_UTIL.TO_GMLGEOMETRY'
return
super
(
AsGML
,
clone
)
.
as_sql
(
compiler
,
connection
,
**
extra_context
)
class
AsKML
(
AsGML
):
class
AsKML
(
AsGML
):
def
as_sqlite
(
self
,
compiler
,
connection
):
def
as_sqlite
(
self
,
compiler
,
connection
):
...
...
docs/ref/contrib/gis/db-api.txt
Dosyayı görüntüle @
5a23cc00
...
@@ -379,7 +379,7 @@ Function PostGIS Oracle MySQL SpatiaLite
...
@@ -379,7 +379,7 @@ Function PostGIS Oracle MySQL SpatiaLite
==================================== ======= ====== =========== ==========
==================================== ======= ====== =========== ==========
:class:`Area` X X X X
:class:`Area` X X X X
:class:`AsGeoJSON` X X
:class:`AsGeoJSON` X X
:class:`AsGML` X
X
:class:`AsGML` X
X
X
:class:`AsKML` X X
:class:`AsKML` X X
:class:`AsSVG` X X
:class:`AsSVG` X X
:class:`BoundingCircle` X
:class:`BoundingCircle` X
...
...
docs/ref/contrib/gis/functions.txt
Dosyayı görüntüle @
5a23cc00
...
@@ -81,7 +81,7 @@ Keyword Argument Description
...
@@ -81,7 +81,7 @@ Keyword Argument Description
.. class:: AsGML(expression, version=2, precision=8, **extra)
.. class:: AsGML(expression, version=2, precision=8, **extra)
*Availability*: PostGIS, SpatiaLite
*Availability*:
Oracle,
PostGIS, SpatiaLite
Accepts a single geographic field or expression and returns a `Geographic Markup
Accepts a single geographic field or expression and returns a `Geographic Markup
Language (GML)`__ representation of the geometry.
Language (GML)`__ representation of the geometry.
...
@@ -98,13 +98,17 @@ Keyword Argument Description
...
@@ -98,13 +98,17 @@ Keyword Argument Description
===================== =====================================================
===================== =====================================================
``precision`` Specifies the number of significant digits for the
``precision`` Specifies the number of significant digits for the
coordinates in the GML representation -- the default
coordinates in the GML representation -- the default
value is 8.
value is 8.
Ignored on Oracle.
``version`` Specifies the GML version to use: 2 (default) or 3.
``version`` Specifies the GML version to use: 2 (default) or 3.
===================== =====================================================
===================== =====================================================
__ https://en.wikipedia.org/wiki/Geography_Markup_Language
__ https://en.wikipedia.org/wiki/Geography_Markup_Language
.. versionchanged:: 1.11
Oracle support was added.
``AsKML``
``AsKML``
=========
=========
...
...
docs/releases/1.11.txt
Dosyayı görüntüle @
5a23cc00
...
@@ -164,7 +164,8 @@ Minor features
...
@@ -164,7 +164,8 @@ Minor features
:lookup:`isvalid` lookup.
:lookup:`isvalid` lookup.
* Added Oracle support for the
* Added Oracle support for the
:class:`~django.contrib.gis.db.models.functions.IsValid` function and
:class:`~django.contrib.gis.db.models.functions.AsGML` function,
:class:`~django.contrib.gis.db.models.functions.IsValid` function, and
:lookup:`isvalid` lookup.
:lookup:`isvalid` lookup.
:mod:`django.contrib.messages`
:mod:`django.contrib.messages`
...
...
tests/gis_tests/geoapp/test_functions.py
Dosyayı görüntüle @
5a23cc00
...
@@ -11,7 +11,7 @@ from django.db.models import Sum
...
@@ -11,7 +11,7 @@ from django.db.models import Sum
from
django.test
import
TestCase
,
skipUnlessDBFeature
from
django.test
import
TestCase
,
skipUnlessDBFeature
from
django.utils
import
six
from
django.utils
import
six
from
..utils
import
mysql
,
oracle
,
postgis
,
spatialite
from
..utils
import
mysql
,
oracle
,
spatialite
from
.models
import
City
,
Country
,
CountryWebMercator
,
State
,
Track
from
.models
import
City
,
Country
,
CountryWebMercator
,
State
,
Track
...
@@ -104,7 +104,7 @@ class GISFunctionsTests(TestCase):
...
@@ -104,7 +104,7 @@ class GISFunctionsTests(TestCase):
if
oracle
:
if
oracle
:
# No precision parameter for Oracle :-/
# No precision parameter for Oracle :-/
gml_regex
=
re
.
compile
(
gml_regex
=
re
.
compile
(
r'^<gml:Point srsName="
SDO
:4326" xmlns:gml="http://www.opengis.net/gml">'
r'^<gml:Point srsName="
EPSG
:4326" xmlns:gml="http://www.opengis.net/gml">'
r'<gml:coordinates decimal="\." cs="," ts=" ">-104.60925\d+,38.25500\d+ '
r'<gml:coordinates decimal="\." cs="," ts=" ">-104.60925\d+,38.25500\d+ '
r'</gml:coordinates></gml:Point>'
r'</gml:coordinates></gml:Point>'
)
)
...
@@ -113,14 +113,11 @@ class GISFunctionsTests(TestCase):
...
@@ -113,14 +113,11 @@ class GISFunctionsTests(TestCase):
r'^<gml:Point srsName="EPSG:4326"><gml:coordinates>'
r'^<gml:Point srsName="EPSG:4326"><gml:coordinates>'
r'-104\.60925\d+,38\.255001</gml:coordinates></gml:Point>'
r'-104\.60925\d+,38\.255001</gml:coordinates></gml:Point>'
)
)
self
.
assertTrue
(
gml_regex
.
match
(
ptown
.
gml
))
self
.
assertTrue
(
gml_regex
.
match
(
ptown
.
gml
))
self
.
assertIn
(
if
postgis
:
'<gml:pos srsDimension="2">'
,
self
.
assertIn
(
City
.
objects
.
annotate
(
gml
=
functions
.
AsGML
(
'point'
,
version
=
3
))
.
get
(
name
=
'Pueblo'
)
.
gml
'<gml:pos srsDimension="2">'
,
)
City
.
objects
.
annotate
(
gml
=
functions
.
AsGML
(
'point'
,
version
=
3
))
.
get
(
name
=
'Pueblo'
)
.
gml
)
@skipUnlessDBFeature
(
"has_AsKML_function"
)
@skipUnlessDBFeature
(
"has_AsKML_function"
)
def
test_askml
(
self
):
def
test_askml
(
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