I have an application where the full WKT representation of double-precision 
floats is undesirable.

It seems that WKTWriter has an optional, keyword argument to set the 
"rounding_precision".  Great! Just what I need!

However... I can't figure out the calling convention; the ".wkt" method of the 
shapely object is a PROPERTY... so although the "kwargs" is defined, I can't 
figure out the right Python syntax to USE them.

Examples:

>>> from shapely.geometry import Polygon
>>> p1 = Polygon([(0,0), (10.1, 0), (31./3, 10), (0, 10)])
>>> print p1.wkt
POLYGON ((0 0, 10.1 0, 10.33333333333333 10, 0 10, 0 0))
# as expected

>>> print p1.wkt(rounding_precision=8)
TypeError: 'str' object is not callable
# bummer: I'd like to use something this concise

>>> from shapely.geos import lgeos, WKTWriter
>>> writer = WKTWriter(lgeos, rounding_precision=8)
>>> print writer.write(p1)
POLYGON ((0 0, 10.1 0, 10.333333 10, 0 10, 0 0))
# this is the result what I want; can it be done without expressly
# creating a WKTWriter()?


How can I pass the "rounding_precision" kwarg to the property getter?

Thanks,
Dan

_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

Reply via email to