mirror of
https://github.com/django/django.git
synced 2025-09-17 06:29:13 +00:00
Fixed #27552 -- Added docs/test for GEOSGeometry.normalize().
This commit is contained in:
parent
8eb56f3c78
commit
21322f9271
@ -259,7 +259,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
|
|||||||
|
|
||||||
def normalize(self):
|
def normalize(self):
|
||||||
"Converts this Geometry to normal form (or canonical form)."
|
"Converts this Geometry to normal form (or canonical form)."
|
||||||
return capi.geos_normalize(self.ptr)
|
capi.geos_normalize(self.ptr)
|
||||||
|
|
||||||
# #### Unary predicates ####
|
# #### Unary predicates ####
|
||||||
@property
|
@property
|
||||||
|
@ -652,6 +652,17 @@ Other Properties & Methods
|
|||||||
positive integer even if it was called with a
|
positive integer even if it was called with a
|
||||||
:class:`~django.contrib.gis.gdal.CoordTransform` object.
|
:class:`~django.contrib.gis.gdal.CoordTransform` object.
|
||||||
|
|
||||||
|
.. method:: GEOSGeometry.normalize()
|
||||||
|
|
||||||
|
Converts this geometry to canonical form::
|
||||||
|
|
||||||
|
>>> g = MultiPoint(Point(0, 0), Point(2, 2), Point(1, 1))
|
||||||
|
>>> print(g)
|
||||||
|
MULTIPOINT (0 0, 2 2, 1 1)
|
||||||
|
>>> g.normalize()
|
||||||
|
>>> print(g)
|
||||||
|
MULTIPOINT (2 2, 1 1, 0 0)
|
||||||
|
|
||||||
``Point``
|
``Point``
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
@ -1331,6 +1331,11 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_normalize(self):
|
||||||
|
g = MultiPoint(Point(0, 0), Point(2, 2), Point(1, 1))
|
||||||
|
self.assertIsNone(g.normalize())
|
||||||
|
self.assertTrue(g.equals_exact(MultiPoint(Point(2, 2), Point(1, 1), Point(0, 0))))
|
||||||
|
|
||||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||||
def test_deprecated_srid_getters_setters(self):
|
def test_deprecated_srid_getters_setters(self):
|
||||||
p = Point(1, 2, srid=123)
|
p = Point(1, 2, srid=123)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user