Is there a control in Openlayers 2 to show scale similar to the new Openlayers v3/4/5 which displays in ft or miles depending on zoom level?

Eventually I will rewrite in OL5, but I'm maintaining OL2 code but would like to display the distance like this. Here is the example with the new version of OL. Maybe someone has created a solution in OpenLayers 2?

Scale Control Example


Oh, this was always in Openlayers 2! I just hadn't found it yet for some reason. Simple method of adding it is: map.addControl(new OpenLayers.Control.ScaleLine());

All set.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.