diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-04-02 23:24:06 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-04-02 14:24:06 -0400 |
| commit | 5e710cf4a5dba1fc30e3b6775b83c2218e57cd36 (patch) | |
| tree | 7c6f74edfb1861d6305178e6ddce5e9807ca1702 /django | |
| parent | 4f99ba84b3efd4b33721288cbbe1a605c7f937fd (diff) | |
Fixed #11854 -- Added Azimuth GIS function. (#8286)
Diffstat (limited to 'django')
5 files changed, 12 insertions, 6 deletions
diff --git a/django/contrib/gis/db/backends/base/operations.py b/django/contrib/gis/db/backends/base/operations.py index ba3d3bdf67..0732d517c6 100644 --- a/django/contrib/gis/db/backends/base/operations.py +++ b/django/contrib/gis/db/backends/base/operations.py @@ -25,7 +25,7 @@ class BaseSpatialOperations: # Blacklist/set of known unsupported functions of the backend unsupported_functions = { - 'Area', 'AsGeoJSON', 'AsGML', 'AsKML', 'AsSVG', + 'Area', 'AsGeoJSON', 'AsGML', 'AsKML', 'AsSVG', 'Azimuth', 'BoundingCircle', 'Centroid', 'Difference', 'Distance', 'Envelope', 'ForceRHR', 'GeoHash', 'Intersection', 'IsValid', 'Length', 'LineLocatePoint', 'MakeValid', 'MemSize', 'NumGeometries', diff --git a/django/contrib/gis/db/backends/mysql/operations.py b/django/contrib/gis/db/backends/mysql/operations.py index 33f148f5f6..0ea9f8f274 100644 --- a/django/contrib/gis/db/backends/mysql/operations.py +++ b/django/contrib/gis/db/backends/mysql/operations.py @@ -72,7 +72,7 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations): @cached_property def unsupported_functions(self): unsupported = { - 'AsGML', 'AsKML', 'AsSVG', 'BoundingCircle', 'ForceRHR', + 'AsGML', 'AsKML', 'AsSVG', 'Azimuth', 'BoundingCircle', 'ForceRHR', 'LineLocatePoint', 'MakeValid', 'MemSize', 'Perimeter', 'PointOnSurface', 'Reverse', 'Scale', 'SnapToGrid', 'Transform', 'Translate', diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index 649449b160..cbe90d6f53 100644 --- a/django/contrib/gis/db/backends/oracle/operations.py +++ b/django/contrib/gis/db/backends/oracle/operations.py @@ -111,9 +111,9 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations): } unsupported_functions = { - 'AsGeoJSON', 'AsKML', 'AsSVG', 'Envelope', 'ForceRHR', 'GeoHash', - 'LineLocatePoint', 'MakeValid', 'MemSize', 'Scale', 'SnapToGrid', - 'Translate', + 'AsGeoJSON', 'AsKML', 'AsSVG', 'Azimuth', 'Envelope', 'ForceRHR', + 'GeoHash', '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 23b38694f8..42b079bbfa 100644 --- a/django/contrib/gis/db/backends/spatialite/operations.py +++ b/django/contrib/gis/db/backends/spatialite/operations.py @@ -93,7 +93,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): def unsupported_functions(self): unsupported = {'BoundingCircle', 'ForceRHR', 'MemSize'} if not self.lwgeom_version(): - unsupported |= {'GeoHash', 'IsValid', 'MakeValid'} + unsupported |= {'Azimuth', 'GeoHash', 'IsValid', 'MakeValid'} return unsupported @cached_property diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py index ee2df7cfb4..3dd8efaa22 100644 --- a/django/contrib/gis/db/models/functions.py +++ b/django/contrib/gis/db/models/functions.py @@ -162,6 +162,12 @@ class Area(OracleToleranceMixin, GeoFunc): return self.as_sql(compiler, connection, **extra_context) +class Azimuth(GeoFunc): + output_field_class = FloatField + arity = 2 + geom_param_pos = (0, 1) + + class AsGeoJSON(GeoFunc): output_field_class = TextField |
