diff --git a/src/ol/projection.js b/src/ol/projection.js
index ad48201ad8..ca3e93ea88 100644
--- a/src/ol/projection.js
+++ b/src/ol/projection.js
@@ -33,6 +33,16 @@ ol.ProjectionUnits = {
};
+/**
+ * @const {Object.
} Meters per unit lookup table.
+ */
+ol.METERS_PER_UNIT = {};
+ol.METERS_PER_UNIT[ol.ProjectionUnits.DEGREES] =
+ 2 * Math.PI * ol.sphere.NORMAL.radius / 360;
+ol.METERS_PER_UNIT[ol.ProjectionUnits.FEET] = 0.3048;
+ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1;
+
+
/**
* @constructor
@@ -109,6 +119,14 @@ ol.Projection.prototype.getUnits = function() {
};
+/**
+ * @return {number} Meters.
+ */
+ol.Projection.prototype.getMetersPerUnit = function() {
+ return ol.METERS_PER_UNIT[this.units_];
+};
+
+
/**
* @return {string} Axis orientation.
*/
diff --git a/test/spec/ol/projection.test.js b/test/spec/ol/projection.test.js
index 34e87ca0b3..4b93b524d3 100644
--- a/test/spec/ol/projection.test.js
+++ b/test/spec/ol/projection.test.js
@@ -221,7 +221,6 @@ describe('ol.projection', function() {
});
-
describe('ol.projection.getTransformFromCodes()', function() {
it('returns a function', function() {
@@ -321,6 +320,15 @@ describe('ol.projection', function() {
});
+ describe('ol.Projection.prototype.getMetersPerUnit()', function() {
+
+ it('returns value in meters', function() {
+ var epsg4326 = ol.projection.getFromCode('EPSG:4326');
+ expect(epsg4326.getMetersPerUnit()).toEqual(111194.87428468118);
+ });
+
+ });
+
});
goog.require('goog.array');