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
ede4f6d4
Kaydet (Commit)
ede4f6d4
authored
Nis 01, 2017
tarafından
Sergey Fedoseev
Kaydeden (comit)
Tim Graham
Nis 01, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #12410 -- Added LineLocatePoint GIS function.
üst
7b530414
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
7 deletions
+38
-7
operations.py
django/contrib/gis/db/backends/base/operations.py
+4
-4
operations.py
django/contrib/gis/db/backends/mysql/operations.py
+3
-2
operations.py
django/contrib/gis/db/backends/oracle/operations.py
+2
-1
operations.py
django/contrib/gis/db/backends/spatialite/operations.py
+1
-0
functions.py
django/contrib/gis/db/models/functions.py
+6
-0
db-api.txt
docs/ref/contrib/gis/db-api.txt
+1
-0
functions.txt
docs/ref/contrib/gis/functions.txt
+13
-0
2.0.txt
docs/releases/2.0.txt
+3
-0
test_functions.py
tests/gis_tests/geoapp/test_functions.py
+5
-0
No files found.
django/contrib/gis/db/backends/base/operations.py
Dosyayı görüntüle @
ede4f6d4
...
@@ -27,10 +27,10 @@ class BaseSpatialOperations:
...
@@ -27,10 +27,10 @@ class BaseSpatialOperations:
unsupported_functions
=
{
unsupported_functions
=
{
'Area'
,
'AsGeoJSON'
,
'AsGML'
,
'AsKML'
,
'AsSVG'
,
'Area'
,
'AsGeoJSON'
,
'AsGML'
,
'AsKML'
,
'AsSVG'
,
'BoundingCircle'
,
'Centroid'
,
'Difference'
,
'Distance'
,
'Envelope'
,
'BoundingCircle'
,
'Centroid'
,
'Difference'
,
'Distance'
,
'Envelope'
,
'ForceRHR'
,
'GeoHash'
,
'Intersection'
,
'IsValid'
,
'Length'
,
'MakeValid'
,
'ForceRHR'
,
'GeoHash'
,
'Intersection'
,
'IsValid'
,
'Length'
,
'
MemSize'
,
'NumGeometries'
,
'NumPoints'
,
'Perimeter'
,
'PointOnSurface
'
,
'
LineLocatePoint'
,
'MakeValid'
,
'MemSize'
,
'NumGeometries
'
,
'
Reverse'
,
'Scale'
,
'SnapToGrid'
,
'SymDifference'
,
'Transform
'
,
'
NumPoints'
,
'Perimeter'
,
'PointOnSurface'
,
'Reverse'
,
'Scale
'
,
'Translate'
,
'Union'
,
'
SnapToGrid'
,
'SymDifference'
,
'Transform'
,
'
Translate'
,
'Union'
,
}
}
# Constructors
# Constructors
...
...
django/contrib/gis/db/backends/mysql/operations.py
Dosyayı görüntüle @
ede4f6d4
...
@@ -73,8 +73,9 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
...
@@ -73,8 +73,9 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
def
unsupported_functions
(
self
):
def
unsupported_functions
(
self
):
unsupported
=
{
unsupported
=
{
'AsGML'
,
'AsKML'
,
'AsSVG'
,
'BoundingCircle'
,
'ForceRHR'
,
'AsGML'
,
'AsKML'
,
'AsSVG'
,
'BoundingCircle'
,
'ForceRHR'
,
'MakeValid'
,
'MemSize'
,
'Perimeter'
,
'PointOnSurface'
,
'Reverse'
,
'LineLocatePoint'
,
'MakeValid'
,
'MemSize'
,
'Perimeter'
,
'Scale'
,
'SnapToGrid'
,
'Transform'
,
'Translate'
,
'PointOnSurface'
,
'Reverse'
,
'Scale'
,
'SnapToGrid'
,
'Transform'
,
'Translate'
,
}
}
if
self
.
connection
.
mysql_version
<
(
5
,
7
,
5
):
if
self
.
connection
.
mysql_version
<
(
5
,
7
,
5
):
unsupported
.
update
({
'AsGeoJSON'
,
'GeoHash'
,
'IsValid'
})
unsupported
.
update
({
'AsGeoJSON'
,
'GeoHash'
,
'IsValid'
})
...
...
django/contrib/gis/db/backends/oracle/operations.py
Dosyayı görüntüle @
ede4f6d4
...
@@ -112,7 +112,8 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
...
@@ -112,7 +112,8 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
unsupported_functions
=
{
unsupported_functions
=
{
'AsGeoJSON'
,
'AsKML'
,
'AsSVG'
,
'Envelope'
,
'ForceRHR'
,
'GeoHash'
,
'AsGeoJSON'
,
'AsKML'
,
'AsSVG'
,
'Envelope'
,
'ForceRHR'
,
'GeoHash'
,
'MakeValid'
,
'MemSize'
,
'Scale'
,
'SnapToGrid'
,
'Translate'
,
'LineLocatePoint'
,
'MakeValid'
,
'MemSize'
,
'Scale'
,
'SnapToGrid'
,
'Translate'
,
}
}
def
geo_quote_name
(
self
,
name
):
def
geo_quote_name
(
self
,
name
):
...
...
django/contrib/gis/db/backends/spatialite/operations.py
Dosyayı görüntüle @
ede4f6d4
...
@@ -81,6 +81,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
...
@@ -81,6 +81,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
def
function_names
(
self
):
def
function_names
(
self
):
return
{
return
{
'Length'
:
'ST_Length'
,
'Length'
:
'ST_Length'
,
'LineLocatePoint'
:
'ST_Line_Locate_Point'
,
'NumPoints'
:
'ST_NPoints'
,
'NumPoints'
:
'ST_NPoints'
,
'Reverse'
:
'ST_Reverse'
,
'Reverse'
:
'ST_Reverse'
,
'Scale'
:
'ScaleCoords'
,
'Scale'
:
'ScaleCoords'
,
...
...
django/contrib/gis/db/models/functions.py
Dosyayı görüntüle @
ede4f6d4
...
@@ -389,6 +389,12 @@ class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
...
@@ -389,6 +389,12 @@ class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
return
super
()
.
as_sql
(
compiler
,
connection
,
function
=
function
)
return
super
()
.
as_sql
(
compiler
,
connection
,
function
=
function
)
class
LineLocatePoint
(
GeoFunc
):
output_field_class
=
FloatField
arity
=
2
geom_param_pos
=
(
0
,
1
)
class
MakeValid
(
GeoFunc
):
class
MakeValid
(
GeoFunc
):
pass
pass
...
...
docs/ref/contrib/gis/db-api.txt
Dosyayı görüntüle @
ede4f6d4
...
@@ -386,6 +386,7 @@ Function PostGIS Oracle MySQL Spat
...
@@ -386,6 +386,7 @@ Function PostGIS Oracle MySQL Spat
:class:`Intersection` X X X (≥ 5.6.1) X
:class:`Intersection` X X X (≥ 5.6.1) X
:class:`IsValid` X X X (≥ 5.7.5) X (LWGEOM)
:class:`IsValid` X X X (≥ 5.7.5) X (LWGEOM)
:class:`Length` X X X X
:class:`Length` X X X X
:class:`LineLocatePoint` X X
:class:`MakeValid` X X (LWGEOM)
:class:`MakeValid` X X (LWGEOM)
:class:`MemSize` X
:class:`MemSize` X
:class:`NumGeometries` X X X X
:class:`NumGeometries` X X X X
...
...
docs/ref/contrib/gis/functions.txt
Dosyayı görüntüle @
ede4f6d4
...
@@ -358,6 +358,19 @@ resource-intensive) with the ``spheroid`` keyword argument.
...
@@ -358,6 +358,19 @@ resource-intensive) with the ``spheroid`` keyword argument.
In older versions, a raw value was returned on MySQL when used on
In older versions, a raw value was returned on MySQL when used on
projected SRS.
projected SRS.
``LineLocatePoint``
===================
.. class:: LineLocatePoint(linestring, point, **extra)
.. versionadded:: 2.0
*Availability*: `PostGIS <https://postgis.net/docs/ST_LineLocatePoint.html>`__,
SpatiaLite
Returns a float between 0 and 1 representing the location of the closest point on
``linestring`` to the given ``point``, as a fraction of the 2D line length.
``MakeValid``
``MakeValid``
=============
=============
...
...
docs/releases/2.0.txt
Dosyayı görüntüle @
ede4f6d4
...
@@ -68,6 +68,9 @@ Minor features
...
@@ -68,6 +68,9 @@ Minor features
:class:`~django.contrib.gis.db.models.functions.IsValid` function, and
:class:`~django.contrib.gis.db.models.functions.IsValid` function, and
:lookup:`isvalid` lookup.
:lookup:`isvalid` lookup.
* Added the :class:`~django.contrib.gis.db.models.functions.LineLocatePoint`
function, supported on PostGIS and SpatiaLite.
:mod:`django.contrib.messages`
:mod:`django.contrib.messages`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
tests/gis_tests/geoapp/test_functions.py
Dosyayı görüntüle @
ede4f6d4
...
@@ -286,6 +286,11 @@ class GISFunctionsTests(TestCase):
...
@@ -286,6 +286,11 @@ class GISFunctionsTests(TestCase):
with
self
.
assertRaisesMessage
(
ValueError
,
'AreaField only accepts Area measurement objects.'
):
with
self
.
assertRaisesMessage
(
ValueError
,
'AreaField only accepts Area measurement objects.'
):
qs
.
get
(
area__lt
=
500000
)
qs
.
get
(
area__lt
=
500000
)
@skipUnlessDBFeature
(
"has_LineLocatePoint_function"
)
def
test_line_locate_point
(
self
):
pos_expr
=
functions
.
LineLocatePoint
(
LineString
((
0
,
0
),
(
0
,
3
),
srid
=
4326
),
Point
(
0
,
1
,
srid
=
4326
))
self
.
assertAlmostEqual
(
State
.
objects
.
annotate
(
pos
=
pos_expr
)
.
first
()
.
pos
,
0.3333333
)
@skipUnlessDBFeature
(
"has_MakeValid_function"
)
@skipUnlessDBFeature
(
"has_MakeValid_function"
)
def
test_make_valid
(
self
):
def
test_make_valid
(
self
):
invalid_geom
=
fromstr
(
'POLYGON((0 0, 0 1, 1 1, 1 0, 1 1, 1 0, 0 0))'
)
invalid_geom
=
fromstr
(
'POLYGON((0 0, 0 1, 1 1, 1 0, 1 1, 1 0, 0 0))'
)
...
...
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