Use getMetersPerUnit

This commit is contained in:
Tim Schaub
2014-10-14 13:45:23 -06:00
parent a121d4c568
commit 8b3677967d
+5 -5
View File
@@ -252,7 +252,8 @@ ol.proj.Projection.prototype.setWorldExtent = function(worldExtent) {
* @return {number} Point resolution. * @return {number} Point resolution.
*/ */
ol.proj.Projection.prototype.getPointResolution = function(resolution, point) { ol.proj.Projection.prototype.getPointResolution = function(resolution, point) {
if (this.getUnits() == ol.proj.Units.DEGREES) { var units = this.getUnits();
if (units == ol.proj.Units.DEGREES) {
return resolution; return resolution;
} else { } else {
// Estimate point resolution by transforming the center pixel to EPSG:4326, // Estimate point resolution by transforming the center pixel to EPSG:4326,
@@ -272,10 +273,9 @@ ol.proj.Projection.prototype.getPointResolution = function(resolution, point) {
var height = ol.sphere.NORMAL.haversineDistance( var height = ol.sphere.NORMAL.haversineDistance(
vertices.slice(4, 6), vertices.slice(6, 8)); vertices.slice(4, 6), vertices.slice(6, 8));
var pointResolution = (width + height) / 2; var pointResolution = (width + height) / 2;
if (this.getUnits() == ol.proj.Units.FEET) { var metersPerUnit = this.getMetersPerUnit();
// The radius of the normal sphere is defined in meters, so we must if (goog.isDef(metersPerUnit)) {
// convert back to feet. pointResolution /= metersPerUnit;
pointResolution /= 0.3048;
} }
return pointResolution; return pointResolution;
} }