diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index a9787a16ed..f36fefdc0c 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -810,6 +810,24 @@ OpenLayers.Map.prototype = { return resolution; }, + /** + * @returns The current scale denominator of the map. + * If no baselayer is set, returns null. + * @type float + */ + getScale: function () { + var scale = null; + + if (this.baseLayer != null) { + var res = this.baseLayer.getResolution(); + var units = this.baseLayer.units; + scale = res * OpenLayers.INCHES_PER_UNIT[units] * + OpenLayers.DOTS_PER_INCH; + } + return scale; + }, + + /** * @param {OpenLayers.Bounds} bounds *