Allow getMetersPerUnit to work without units identifier (see #814)

This commit is contained in:
Tim Schaub
2013-06-24 11:34:16 -06:00
parent f697450523
commit d10eff97a2
3 changed files with 35 additions and 1 deletions
+9 -1
View File
@@ -143,7 +143,15 @@ ol.Projection.prototype.getUnits = function() {
* @return {number} Meters.
*/
ol.Projection.prototype.getMetersPerUnit = function() {
return ol.METERS_PER_UNIT[this.units_];
var metersPerUnit;
if (!goog.isNull(this.units_)) {
metersPerUnit = ol.METERS_PER_UNIT[this.units_];
} else {
if (this instanceof ol.Proj4jsProjection_) {
metersPerUnit = this.getProj4jsProj().to_meter;
}
}
return metersPerUnit;
};