gis.geos.WKTWriter.precision

precision

New in Django 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)'
doc_Django
2016-10-09 18:38:34
Comments
Leave a Comment

Please login to continue.