summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2017-04-02 00:02:09 +0500
committerTim Graham <timograham@gmail.com>2017-04-01 15:02:09 -0400
commitede4f6d48c1fe060c239b2477c00df6bbfd4fd7c (patch)
tree953aa4ddd3692a0bf5141bfeb7cb4b1a4fb454ce /django
parent7b53041420009ad430035116c25f36804e714cd5 (diff)
Fixed #12410 -- Added LineLocatePoint GIS function.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/db/backends/base/operations.py8
-rw-r--r--django/contrib/gis/db/backends/mysql/operations.py5
-rw-r--r--django/contrib/gis/db/backends/oracle/operations.py3
-rw-r--r--django/contrib/gis/db/backends/spatialite/operations.py1
-rw-r--r--django/contrib/gis/db/models/functions.py6
5 files changed, 16 insertions, 7 deletions
diff --git a/django/contrib/gis/db/backends/base/operations.py b/django/contrib/gis/db/backends/base/operations.py
index 8fa1c2cd44..ba3d3bdf67 100644
--- a/django/contrib/gis/db/backends/base/operations.py
+++ b/django/contrib/gis/db/backends/base/operations.py
@@ -27,10 +27,10 @@ class BaseSpatialOperations:
unsupported_functions = {
'Area', 'AsGeoJSON', 'AsGML', 'AsKML', 'AsSVG',
'BoundingCircle', 'Centroid', 'Difference', 'Distance', 'Envelope',
- 'ForceRHR', 'GeoHash', 'Intersection', 'IsValid', 'Length', 'MakeValid',
- 'MemSize', 'NumGeometries', 'NumPoints', 'Perimeter', 'PointOnSurface',
- 'Reverse', 'Scale', 'SnapToGrid', 'SymDifference', 'Transform',
- 'Translate', 'Union',
+ 'ForceRHR', 'GeoHash', 'Intersection', 'IsValid', 'Length',
+ 'LineLocatePoint', 'MakeValid', 'MemSize', 'NumGeometries',
+ 'NumPoints', 'Perimeter', 'PointOnSurface', 'Reverse', 'Scale',
+ 'SnapToGrid', 'SymDifference', 'Transform', 'Translate', 'Union',
}
# Constructors
diff --git a/django/contrib/gis/db/backends/mysql/operations.py b/django/contrib/gis/db/backends/mysql/operations.py
index 58aeda4deb..33f148f5f6 100644
--- a/django/contrib/gis/db/backends/mysql/operations.py
+++ b/django/contrib/gis/db/backends/mysql/operations.py
@@ -73,8 +73,9 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
def unsupported_functions(self):
unsupported = {
'AsGML', 'AsKML', 'AsSVG', 'BoundingCircle', 'ForceRHR',
- 'MakeValid', 'MemSize', 'Perimeter', 'PointOnSurface', 'Reverse',
- 'Scale', 'SnapToGrid', 'Transform', 'Translate',
+ 'LineLocatePoint', 'MakeValid', 'MemSize', 'Perimeter',
+ 'PointOnSurface', 'Reverse', 'Scale', 'SnapToGrid', 'Transform',
+ 'Translate',
}
if self.connection.mysql_version < (5, 7, 5):
unsupported.update({'AsGeoJSON', 'GeoHash', 'IsValid'})
diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py
index 62506e4227..649449b160 100644
--- a/django/contrib/gis/db/backends/oracle/operations.py
+++ b/django/contrib/gis/db/backends/oracle/operations.py
@@ -112,7 +112,8 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
unsupported_functions = {
'AsGeoJSON', 'AsKML', 'AsSVG', 'Envelope', 'ForceRHR', 'GeoHash',
- 'MakeValid', 'MemSize', 'Scale', 'SnapToGrid', 'Translate',
+ 'LineLocatePoint', 'MakeValid', 'MemSize', 'Scale', 'SnapToGrid',
+ 'Translate',
}
def geo_quote_name(self, name):
diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py
index 46cac8c0b3..23b38694f8 100644
--- a/django/contrib/gis/db/backends/spatialite/operations.py
+++ b/django/contrib/gis/db/backends/spatialite/operations.py
@@ -81,6 +81,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
def function_names(self):
return {
'Length': 'ST_Length',
+ 'LineLocatePoint': 'ST_Line_Locate_Point',
'NumPoints': 'ST_NPoints',
'Reverse': 'ST_Reverse',
'Scale': 'ScaleCoords',
diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py
index c595a143d0..ee2df7cfb4 100644
--- a/django/contrib/gis/db/models/functions.py
+++ b/django/contrib/gis/db/models/functions.py
@@ -389,6 +389,12 @@ class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
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):
pass