org.geotools.geojson.geom.GeometryJSON rounds coordinates to 4 decimals when using the default constructor, however, there is another constructor taking a decimals parameter.
Now looking into <b>org.geotools.geojson.feature.FeatureJSON</b>, the possibility to control the <b>decimals</b> of its GeometryJSON instance is missing.
The best solution would be to add a <b>second constructor for FeatureJSON</b> as well, e.g.:
Constructs a feature json instance specifying the number of decimals
to use when encoding floating point numbers.
gjson = GeometryJSON(decimals);
attio = DefaultAttributeIO();
..<b>or like Justin mentioned</b> (in the geotools-devel mailing list) utilizing "inversion of control and FeatureJSON be able to take a GeometryJSON instance. That way you don't have to duplicate constructor arguments from GeometryJSON." (see mailing list subject "proposal for controlling decimals on FeatureJSON, too" from 4th Apr. 2011)
Would it be possible to integrate this improvement into the next milestone/RC/release?
CodeHaus Comment From: jdeolive - Time: Wed, 20 Apr 2011 10:24:16 -0500
Yeah, what I have in mind is more this:
The reason being that moving forward there may be other parameters on GeometryJSON that we want to expose. So this would prevent us having to load up the FeatureJSON constructor with those as well.
I see no problem with this getting into the next release. But if you could submit a patch that we could readily apply (with a test case is always nice) it would make it much easier to get it in sooner rather than later. Otherwise it is just when a developer gets around to it.
CodeHaus Comment From: owl-eye - Time: Thu, 5 May 2011 07:15:21 -0500
patch adding an additional constructor taking a GeometryJSON instance like Justin proposed
Mass closing all resolved issues not modified in the last 4 weeks