Hi,

I was looking at the output that was generated with forcedDecimals from
GeoServer's 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
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to