Ticket #2242 (closed bug: fixed)
When writing a WMC, bounds should not be rounded to a predefined precision
| Reported by: | bbinet | Owned by: | bartvde |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.9 Release |
| Component: | Format.WMC | Version: | 2.8 |
| Keywords: | Cc: | tschaub | |
| State: | Complete |
Description
In OpenLayers.Format.WMC, writing the BoundingBox element is using toPrecision(10) to round the bounds to a 10 digit precision in the WMC generated file.
When loading this generated WMC, it can leads to a bad calculation of the map extent because the difference of the rounded bounds with the originals are forcing the Map to change to the next larger scale...
Looking at the WMC specs, it looks like a precision does not need to be forced: http://schemas.opengis.net/context/1.1.0/context.xsd : Bounds of BoundingBoxType are xs:decimal which does not expect a precision: http://www.w3.org/TR/xmlschema-2/#decimal
As I was looking at these precision issues, I also found out that the same precision was forced to ol:maxExtent wereas it's unneeded since it's a vendor param.
Lastly, the format is using a precision of 10 digits to write sld:MinScaleDenominator and sld:MaxScaleDenominator, which type are double according to the specs : http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd
Because it's a double, I recommend to use a 16 digits precision : http://en.wikipedia.org/wiki/Double_precision
The attached patch is addressing this issue.

