When using a center and a scale with the projection EPSG:3857 the scale is converted to a geodetic scale instead of keeping the asked for scale.
For the feature to match with its real length we need to set "geodetic": true for the scalebar and the label.
I think the problem come from the calculation of the bounding box in CenterScaleMapBounds.toReferencedEnvelope() , in which the the discriminant for geodetic bboxes is based on the unit of the projection (degree).
But EPSG:3857 is a geodetic projection with a distance unit in meter, the calculated bounding box is then false.
Setting the map attribute zoomSnapGeodetic to true or false doesn't change the outcome.
You will find an example of this behaviour in https://gist.github.com/didier-coignet-dict/7c9903c0a50b6135848d
When using a center and a scale with the projection EPSG:3857 the scale is converted to a geodetic scale instead of keeping the asked for scale.
For the feature to match with its real length we need to set
"geodetic": truefor the scalebar and the label.I think the problem come from the calculation of the bounding box in
CenterScaleMapBounds.toReferencedEnvelope(), in which the the discriminant for geodetic bboxes is based on the unit of the projection (degree).But EPSG:3857 is a geodetic projection with a distance unit in meter, the calculated bounding box is then false.
Setting the map attribute zoomSnapGeodetic to true or false doesn't change the outcome.
You will find an example of this behaviour in https://gist.github.com/didier-coignet-dict/7c9903c0a50b6135848d