[GIS] How accurate is the Scale Line in OpenLayers

openlayers-2scale bar

Is there any source describing the accuracy of OpenLayer's scale line?
You can get an scale line by using the constructor:

map.addControl(new OpenLayers.Control.ScaleLine());

However, it seems to be very inaccurate in relation to my geodesic measurements (0.5 km – 1.5 km difference depending on zoom). Is there any info I can cite to explain this different?

I'm using OpenLayers "Release 2.13.1" and OSM as base layer. I'm calculating the distance between point using WGS84 projection with 3 decimals and geopy distance module.

As an example, the distance between the points -2.416,55.703 and -2.434,55.698 is 2066.599 m according to my calculations and 2.5 – 3 km according to the scale line depending on zoom.

Ideally, the info I'm looking for is something like "the scale is accurate in +- 1 km because it calculates the distance using X method". The official doc (http://dev.openlayers.org/docs/files/OpenLayers/Control/ScaleLine-js.html) doesn't mention accuracy.

Best Answer

The ScaleLine represents the scale of the map on the screen, and hence is intrinsically different from the scale of a printed map.

The OSM tileset is built using the Web Mercator projection, and this projection does not maintain scale. This is why you do not get perfect scale.

If you want the geodesic scale, you should use the geodesic:true parameter while constructing the Scale line control. You should note, that this gives the geodesic scale at the center of the map, which might not be the same as the scale at other parts of the map.