summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorDaniel Wiesmann <daniel.wiesmann@gmail.com>2016-04-06 12:50:25 +0100
committerTim Graham <timograham@gmail.com>2016-04-09 09:22:30 -0400
commitc12a00e554c8b4b93931b520bb94a479c5ba8706 (patch)
tree235f37a8c8ce8e0e4cc2a8736bcc9b7b14244fdd /docs/ref
parentf6ca63a9f8b3d030097135e096c1041e09c29fd9 (diff)
Fixed #26455 -- Allowed filtering and repairing invalid geometries.
Added the IsValid and MakeValid database functions, and the isvalid lookup, all for PostGIS. Thanks Tim Graham for the review.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/gis/functions.txt39
-rw-r--r--docs/ref/contrib/gis/geoquerysets.txt19
2 files changed, 51 insertions, 7 deletions
diff --git a/docs/ref/contrib/gis/functions.txt b/docs/ref/contrib/gis/functions.txt
index 04da9e78af..00dee42c57 100644
--- a/docs/ref/contrib/gis/functions.txt
+++ b/docs/ref/contrib/gis/functions.txt
@@ -25,13 +25,12 @@ Function's summary:
================== ======================= ====================== =================== ================== =====================
Measurement Relationships Operations Editors Output format Miscellaneous
================== ======================= ====================== =================== ================== =====================
-:class:`Area` :class:`BoundingCircle` :class:`Difference` :class:`ForceRHR` :class:`AsGeoJSON` :class:`MemSize`
-:class:`Distance` :class:`Centroid` :class:`Intersection` :class:`Reverse` :class:`AsGML` :class:`NumGeometries`
-:class:`Length` :class:`Envelope` :class:`SymDifference` :class:`Scale` :class:`AsKML` :class:`NumPoints`
-:class:`Perimeter` :class:`PointOnSurface` :class:`Union` :class:`SnapToGrid` :class:`AsSVG`
-
- :class:`Transform` :class:`GeoHash`
-
+:class:`Area` :class:`BoundingCircle` :class:`Difference` :class:`ForceRHR` :class:`AsGeoJSON` :class:`IsValid`
+:class:`Distance` :class:`Centroid` :class:`Intersection` :class:`MakeValid` :class:`AsGML` :class:`MemSize`
+:class:`Length` :class:`Envelope` :class:`SymDifference` :class:`Reverse` :class:`AsKML` :class:`NumGeometries`
+:class:`Perimeter` :class:`PointOnSurface` :class:`Union` :class:`Scale` :class:`AsSVG` :class:`NumPoints`
+ :class:`SnapToGrid` :class:`GeoHash`
+ :class:`Transform`
:class:`Translate`
================== ======================= ====================== =================== ================== =====================
@@ -291,6 +290,18 @@ intersection between them.
MySQL support was added.
+``IsValid``
+===========
+
+.. class:: IsValid(expr)
+
+.. versionadded:: 1.10
+
+*Availability*: PostGIS
+
+Accepts a geographic field or expression and tests if the value is well formed.
+Returns ``True`` if its value is a valid geometry and ``False`` otherwise.
+
``Length``
==========
@@ -308,6 +319,20 @@ specify if the calculation should be based on a simple sphere (less
accurate, less resource-intensive) or on a spheroid (more accurate, more
resource-intensive) with the ``spheroid`` keyword argument.
+``MakeValid``
+=============
+
+.. class:: MakeValid(expr)
+
+.. versionadded:: 1.10
+
+*Availability*: PostGIS
+
+Accepts a geographic field or expression and attempts to convert the value into
+a valid geometry without losing any of the input vertices. Geometries that are
+already valid are returned without changes. Simple polygons might become a
+multipolygon and the result might be of lower dimension than the input.
+
``MemSize``
===========
diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt
index ed142d72b8..6b12c07a57 100644
--- a/docs/ref/contrib/gis/geoquerysets.txt
+++ b/docs/ref/contrib/gis/geoquerysets.txt
@@ -247,6 +247,25 @@ MySQL ``MBRIntersects(poly, geom)``
SpatiaLite ``Intersects(poly, geom)``
========== =================================================
+.. fieldlookup:: isvalid
+
+``isvalid``
+-----------
+
+.. versionadded:: 1.10
+
+*Availability*: PostGIS
+
+Tests if the geometry is valid.
+
+Example::
+
+ Zipcode.objects.filter(poly__isvalid=True)
+
+PostGIS equivalent::
+
+ SELECT ... WHERE ST_IsValid(poly)
+
.. fieldlookup:: overlaps
``overlaps``