Hi Peter, turns out I wrote that code... but too many years ago to remember :-D So I can't quite recall the original intention, but I believe you got it right, the fast path with the truncation should be used also for numbers that are not too big in absolute terms, that is, going from "x < DECIMAL_MAX" to "abs(x) < DECIMAL_MAX" looks indeed like an improvement
Cheers Andrea On Fri, Aug 13, 2021 at 10:57 PM Peter Rushforth <[email protected]> wrote: > Hi, > > I was looking at the output that was generated with forcedDecimals for WFS > GetFeature MapML formatted requests, and I noticed that for Web Mercator > responses, large negative decimal coordinate values were ignoring the > forcedDecimal setting from the user interface, returning the coordinate in > scientific notation. I traced this back to the GeoTools > CoordinateFormatter class. > > GeoTools' CoordinateFormatter has a condition > <https://github.com/geotools/geotools/blob/89c2e02626e384f31ab74ec8b249ddbe12800c6d/modules/library/xml/src/main/java/org/geotools/gml/producer/CoordinateFormatter.java#L102> > that doesn't use forcedDecimal when the supplied number is in the > -DECIMAL_MIN to +DECIMAL_MIN range, or when the value of the supplied > number is less than the DECIMAL_MAX field, or zero. I *believe* the intent > was that the default formatting code path (scientific notation, presumably) > should be used when the value of the supplied number was between > -DECIMAL_MAX and +DECIMAL_MAX but not in the -DECIMAL_MIN to +DECIMAL_MIN > range, nor zero. > > So I changed it > <https://github.com/Maps4HTML/geotools/blob/b430b40cc19b4c6d5b3915cfad451677a217d37b/modules/library/xml/src/main/java/org/geotools/gml/producer/CoordinateFormatter.java#L102>, > and added some > <https://github.com/Maps4HTML/geotools/blob/b430b40cc19b4c6d5b3915cfad451677a217d37b/modules/library/xml/src/test/java/org/geotools/gml/producer/CoordinateFormatterTest.java#L31> > tests > > <https://github.com/Maps4HTML/geotools/blob/b430b40cc19b4c6d5b3915cfad451677a217d37b/modules/library/xml/src/test/java/org/geotools/gml/producer/CoordinateFormatterTest.java#L58>to > cover the changes, and without changing any other tests, it passes. I also > ran the GeoServer tests on these branches / artifacts and they also pass. > > If I don't hear differing opinions in response to this, I'll go ahead and > create a JIRA issue and a couple of PRs to close the issue. > > Thanks! > Peter > _______________________________________________ > Geoserver-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geoserver-devel >
_______________________________________________ Geoserver-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-devel
