[geos-devel] Proposal: Change WKTWriter.setTrim(true) to be default

Martin Davis mtnclimb at gmail.com
Thu Jan 7 12:19:31 PST 2021


Paul's fine work on adding Ryu [1] finally makes WKTWriter numeric output
work as the API implies (i.e. precision means "decimal places" rather than
the C-style "significant digits").  This brings GEOS in line with JTS, and
more importantly makes it behave in a way that works better for geospatial
numeric values.

I suggest one further change: make this the default mode for WKTWriter
output.

Technically, this means that WKTWriter.setTrim(true) will be the default
mode (unlike now, where trim=false is the default).

The effect of this will be to change default output from looking like this:

bin/geosop -a "Point (1 2)" -f wkt
POINT (1.0000000000000000 2.0000000000000000)

to this (which is much better IMO)

POINT (1 2)

Making trim=true mode the default will mean that downstream clients will
get sensible behaviour as the default, which should prevent bug reports
like GH #375 [2].

This will have a potential impact on downstream testing, if they are
testing exact character output.  Hopefully this won't be too much effort to
correct, and is worthwhile, since it avoids baking in tests for undesirable
behaviour.  And in any case it seems likely that downstream will always set
trim=true anyway, to avoid the kind of issues mentioned in that ticket.

Furthermore, if this is done then it seems like there is no need for a
trim=false mode at all. So we can deprecate and no-op that API method.

Comments?

[1]
https://github.com/libgeos/geos/commit/2376cd6bf5d0743b02b588af17d2e9067c1874de
[2] https://github.com/libgeos/geos/issues/375
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20210107/21e601a7/attachment.html>


More information about the geos-devel mailing list