I search a lot about this problem but I don't find a solution, so... I'm using a projection and the scaleLine display the value 100.000 greater than the real value, How can I solve this problem?
Here my OpenLayers 4 code:
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs";
var projection = new ol.proj.Projection({
code: 'EPSG:27700',
units: 'm'
});
controls: ol.control.defaults({
attributionOptions: ({
collapsible: false
})
}).extend([
// add the actual scale in "m"
new ol.control.ScaleLine({units:'metric', target:
document.getElementById('map_extras')})
]),
layers: [layers, orders],
target: 'mapdiv',
view: new ol.View({
projection: projection,
center: ol.proj.fromLonLat([parseInt(setPos[0]), parseInt(setPos[1])], projection),
resolution: 2.8,
resolutions: [2.8, 1.4, 0.7, 0.28, 0.14, 0.07],
})
Also, something that I saw is when you move the map in x y axis the scaleLine sometimes changes without modifying the actual zoom, is this also a common problem when you are using a projection?