Displaying a scale for a non isometric projection is always error-prone. The error increase with the visible latitude range.
To demonstrate the effect, look at extreme situations. The default projection is Mercator.
- So open a new layer and show Bing imagery.
- Zoom out as far as possible.
- Scroll the visible world to the top: The scale shows 666.2 km.
- Grab the world and move it slowly to the bottom.
- Up to the middle the scape grows to something like 8200 km
- Below the middle, the value shrinks to 657.7 km
What is the sense of this scale? Does it mean “2cm on the map are something between 650 and 8200 km”? We could show a mean value with error range like “4425 km ± 3775 km”.
We have the same problem for smaller visible areas, but not so pronounced. If you zoom so that Spain is filling the view from top to bottom, the scale shows something around 100 km. But this value is only valid for the middle of the map. Grab the map in the middle and move to top and to the bottom. The scale changes between 104 (top) and 93 (button) we have an error of about 10% in this case. When we do the same with the Bodensee, I get 5.41 km in the middle and 5.44 for the top and 5.39 for the button. This is an error of about 1%.
The scale (for Mercator) is only valid for a specific latitude. The larger the shown latitude range, the larger is the scale error.
We should either show an error range: <mean> km ± <error range> (102.3 km ± 1.2 km)
or an value range: <lowest visible scale> - <highest visible scale> (101.1 km – 103.5 km)
or we should hide the scale if the error is to big.
The error depends of the projection and min and max latitude:
minLat = visibleArea.getBottomLatitude();
maxLat = visibleArea.getTopLatitude();
// check if equator is in the visible range
if (minLax * maxLat <0) {
minLat = 0;
}