[geos-devel] WKT Precision
Paul Ramsey
pramsey at cleverelephant.ca
Tue Jan 5 15:41:40 PST 2021
This is a totally evergreen topic, and I'm not sure if it's been chewed over before. Right now the behaviour of setRoundingPrecision and setTrim in the WKTWriter is a little counterintuitive (or not!) and there's a ticket on that.
https://github.com/libgeos/geos/issues/375
Basically, when setTrim(true) the roundingPrecision() will set the number of sigfigs in the output, but when setTrim(false) then roundingPrecision() will set the number of digits after the decimal point. The reporter of this ticket seems to thing that roundingPrecision() should always control the number of digits after the decimal point, and that setTrim() will just lop off extraneous zeroes as necessary.
Meanwhile we have this extant feature request
https://trac.osgeo.org/geos/ticket/868
This is more grandiose, potentially we could bring in a whole fancy double output library (not sure if that's needed).
Meanwhile, I've just done a very small change that makes the behaviour match up to what the first reporter seemed to expect. It broke a lot fewer tests than I expected, but it still broke a handful. And of course the downstream will have all kinds of stuff that is sensitive fo WKT output defaults.
https://github.com/libgeos/geos/pull/378
What do people think is the best practice for outputing WKT precision?
(Also, what do these knobs (setTrim, setRoundingPrecision) mean in JTS world? I'm guessing our behaviour is *not* an exact analogue.
P.
More information about the geos-devel
mailing list