Refs #28841 -- Removed ForceRHR function per deprecation timeline.

This commit is contained in:
Tim Graham 2018-12-27 20:31:55 -05:00
parent 1fecde6be9
commit 6f23996a59
9 changed files with 18 additions and 64 deletions

View File

@ -40,10 +40,10 @@ class BaseSpatialOperations:
unsupported_functions = {
'Area', 'AsGeoJSON', 'AsGML', 'AsKML', 'AsSVG', 'Azimuth',
'BoundingCircle', 'Centroid', 'Difference', 'Distance', 'Envelope',
'ForceRHR', 'GeoHash', 'Intersection', 'IsValid', 'Length',
'LineLocatePoint', 'MakeValid', 'MemSize', 'NumGeometries',
'NumPoints', 'Perimeter', 'PointOnSurface', 'Reverse', 'Scale',
'SnapToGrid', 'SymDifference', 'Transform', 'Translate', 'Union',
'GeoHash', 'Intersection', 'IsValid', 'Length', 'LineLocatePoint',
'MakeValid', 'MemSize', 'NumGeometries', 'NumPoints', 'Perimeter',
'PointOnSurface', 'Reverse', 'Scale', 'SnapToGrid', 'SymDifference',
'Transform', 'Translate', 'Union',
}
# Constructors

View File

@ -56,9 +56,9 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
def unsupported_functions(self):
unsupported = {
'AsGML', 'AsKML', 'AsSVG', 'Azimuth', 'BoundingCircle',
'ForcePolygonCW', 'ForceRHR', 'LineLocatePoint', 'MakeValid',
'MemSize', 'Perimeter', 'PointOnSurface', 'Reverse', 'Scale',
'SnapToGrid', 'Transform', 'Translate',
'ForcePolygonCW', 'LineLocatePoint', 'MakeValid', 'MemSize',
'Perimeter', 'PointOnSurface', 'Reverse', 'Scale', 'SnapToGrid',
'Transform', 'Translate',
}
if self.connection.mysql_is_mariadb:
unsupported.update({'GeoHash', 'IsValid'})

View File

@ -106,9 +106,9 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
}
unsupported_functions = {
'AsGeoJSON', 'AsKML', 'AsSVG', 'Azimuth',
'ForcePolygonCW', 'ForceRHR', 'GeoHash', 'LineLocatePoint',
'MakeValid', 'MemSize', 'Scale', 'SnapToGrid', 'Translate',
'AsGeoJSON', 'AsKML', 'AsSVG', 'Azimuth', 'ForcePolygonCW', 'GeoHash',
'LineLocatePoint', 'MakeValid', 'MemSize', 'Scale', 'SnapToGrid',
'Translate',
}
def geo_quote_name(self, name):

View File

@ -81,7 +81,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
@cached_property
def unsupported_functions(self):
unsupported = {'BoundingCircle', 'ForceRHR', 'MemSize'}
unsupported = {'BoundingCircle', 'MemSize'}
if not self.lwgeom_version():
unsupported |= {'Azimuth', 'GeoHash', 'IsValid', 'MakeValid'}
return unsupported

View File

@ -1,4 +1,3 @@
import warnings
from decimal import Decimal
from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
@ -11,7 +10,6 @@ from django.db.models import (
from django.db.models.expressions import Func, Value
from django.db.models.functions import Cast
from django.db.utils import NotSupportedError
from django.utils.deprecation import RemovedInDjango30Warning
from django.utils.functional import cached_property
NUMERIC_TYPES = (int, float, Decimal)
@ -284,17 +282,6 @@ class ForcePolygonCW(GeomOutputGeoFunc):
arity = 1
class ForceRHR(GeomOutputGeoFunc):
arity = 1
def __init__(self, *args, **kwargs):
warnings.warn(
'ForceRHR is deprecated in favor of ForcePolygonCW.',
RemovedInDjango30Warning, stacklevel=2,
)
super().__init__(*args, **kwargs)
class GeoHash(GeoFunc):
output_field = TextField()

View File

@ -383,7 +383,6 @@ Function PostGIS Oracle MySQL Spat
:class:`Distance` X X X X
:class:`Envelope` X X X X
:class:`ForcePolygonCW` X X
:class:`ForceRHR` X
:class:`GeoHash` X X (≥ 5.7.5) X (LWGEOM)
:class:`Intersection` X X X X
:class:`IsValid` X X X (≥ 5.7.5) X (LWGEOM)

View File

@ -24,12 +24,11 @@ Function's summary:
Measurement Relationships Operations Editors Output format Miscellaneous
================== ======================== ====================== ======================= ================== =====================
:class:`Area` :class:`Azimuth` :class:`Difference` :class:`ForcePolygonCW` :class:`AsGeoJSON` :class:`IsValid`
:class:`Distance` :class:`BoundingCircle` :class:`Intersection` :class:`ForceRHR` :class:`AsGML` :class:`MemSize`
:class:`Length` :class:`Centroid` :class:`SymDifference` :class:`MakeValid` :class:`AsKML` :class:`NumGeometries`
:class:`Perimeter` :class:`Envelope` :class:`Union` :class:`Reverse` :class:`AsSVG` :class:`NumPoints`
.. :class:`LineLocatePoint` :class:`Scale` :class:`GeoHash`
.. :class:`PointOnSurface` :class:`SnapToGrid`
.. :class:`Transform`
:class:`Distance` :class:`BoundingCircle` :class:`Intersection` :class:`MakeValid` :class:`AsGML` :class:`MemSize`
:class:`Length` :class:`Centroid` :class:`SymDifference` :class:`Reverse` :class:`AsKML` :class:`NumGeometries`
:class:`Perimeter` :class:`Envelope` :class:`Union` :class:`Scale` :class:`AsSVG` :class:`NumPoints`
.. :class:`LineLocatePoint` :class:`SnapToGrid` :class:`GeoHash`
.. :class:`PointOnSurface` :class:`Transform`
.. :class:`Translate`
================== ======================== ====================== ======================= ================== =====================
@ -291,21 +290,6 @@ of the polygon/multipolygon in which all exterior rings are oriented clockwise
and all interior rings are oriented counterclockwise. Non-polygonal geometries
are returned unchanged.
``ForceRHR``
============
.. class:: ForceRHR(expression, **extra)
.. deprecated:: 2.1
Use :class:`ForcePolygonCW` instead.
*Availability*: `PostGIS <https://postgis.net/docs/ST_ForceRHR.html>`__
Accepts a single geographic field or expression and returns a modified version
of the polygon/multipolygon in which all of the vertices follow the
right-hand rule.
``GeoHash``
===========

View File

@ -253,4 +253,4 @@ to remove usage of these features.
See :ref:`deprecated-features-2.1` for details on these changes, including how
to remove usage of these features.
* ...
* The ``ForceRHR`` GIS function is removed.

View File

@ -10,8 +10,7 @@ from django.contrib.gis.geos import (
from django.contrib.gis.measure import Area
from django.db import NotSupportedError, connection
from django.db.models import Sum
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
from django.utils.deprecation import RemovedInDjango30Warning
from django.test import TestCase, skipUnlessDBFeature
from ..utils import FuncTestMixin, mysql, oracle, postgis, spatialite
from .models import City, Country, CountryWebMercator, State, Track
@ -230,21 +229,6 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
st = State.objects.annotate(force_polygon_cw=functions.ForcePolygonCW('poly')).get(name='Foo')
self.assertEqual(rhr_rings, st.force_polygon_cw.coords)
@skipUnlessDBFeature("has_ForceRHR_function")
@ignore_warnings(category=RemovedInDjango30Warning)
def test_force_rhr(self):
rings = (
((0, 0), (5, 0), (0, 5), (0, 0)),
((1, 1), (1, 3), (3, 1), (1, 1)),
)
rhr_rings = (
((0, 0), (0, 5), (5, 0), (0, 0)),
((1, 1), (3, 1), (1, 3), (1, 1)),
)
State.objects.create(name='Foo', poly=Polygon(*rings))
st = State.objects.annotate(force_rhr=functions.ForceRHR('poly')).get(name='Foo')
self.assertEqual(rhr_rings, st.force_rhr.coords)
@skipUnlessDBFeature("has_GeoHash_function")
def test_geohash(self):
# Reference query: