diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2015-12-05 19:05:52 +0500 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-12-18 19:44:43 +0100 |
| commit | c984e2bc15aa41de87404d6dd5d7e64f1a8e5038 (patch) | |
| tree | 650a79d43e111973ab77f4c6c25524f4e20519bf /docs | |
| parent | cd3c042b0473e762b0e89bc69a9244c4a1fed66e (diff) | |
Fixed #25869 -- Added trim and precision properties to WKTWriter.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/gis/geos.txt | 38 | ||||
| -rw-r--r-- | docs/releases/1.10.txt | 5 |
2 files changed, 43 insertions, 0 deletions
diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt index 476ea7e233..ddf4f0706f 100644 --- a/docs/ref/contrib/gis/geos.txt +++ b/docs/ref/contrib/gis/geos.txt @@ -1052,6 +1052,44 @@ Returns the WKT of the given geometry. Example:: >>> wkt_w.write(pnt) 'POINT (1.0000000000000000 1.0000000000000000)' +.. attribute:: WKTWriter.trim + +.. versionadded:: 1.10 + +This property is used to enable or disable trimming of +unnecessary decimals. + + >>> from django.contrib.gis.geos import Point, WKTWriter + >>> pnt = Point(1, 1) + >>> wkt_w = WKTWriter() + >>> wkt_w.trim + False + >>> wkt_w.write(pnt) + 'POINT (1.0000000000000000 1.0000000000000000)' + >>> wkt_w.trim = True + >>> wkt_w.write(pnt) + 'POINT (1 1)' + +.. attribute:: WKTWriter.precision + +.. versionadded:: 1.10 + +This property controls the rounding precision of coordinates; +if set to ``None`` rounding is disabled. + + >>> from django.contrib.gis.geos import Point, WKTWriter + >>> pnt = Point(1.44, 1.66) + >>> wkt_w = WKTWriter() + >>> print(wkt_w.precision) + None + >>> wkt_w.write(pnt) + 'POINT (1.4399999999999999 1.6599999999999999)' + >>> wkt_w.precision = 0 + >>> wkt_w.write(pnt) + 'POINT (1 2)' + >>> wkt_w.precision = 1 + >>> wkt_w.write(pnt) + 'POINT (1.4 1.7)' .. rubric:: Footnotes .. [#fnogc] *See* `PostGIS EWKB, EWKT and Canonical Forms <http://postgis.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT>`_, PostGIS documentation at Ch. 4.1.2. diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 64b92a26b6..7be22b12f4 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -94,6 +94,11 @@ Minor features * Added support for instantiating empty GEOS geometries. +* The new :attr:`~django.contrib.gis.geos.WKTWriter.trim` and + :attr:`~django.contrib.gis.geos.WKTWriter.precision` properties + of :class:`~django.contrib.gis.geos.WKTWriter` allow controlling + output of the fractional part of the coordinates in WKT. + :mod:`django.contrib.messages` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
