'm' and 'Meters' in OpenLayers.INCHES_PER_UNIT are not the same
OpenLayers.INCHES_PER_UNIT.m should equal OpenLayers.INCHES_PER_UNIT.Meters, just like OpenLayers.INCHES_PER_UNIT.km should equal OpenLayers.Inches_PER_UNIT.Kilometers. This confusion probably comes from mixing International inches with US Survey inches when compiling the unit conversion list (1 meter is 39.37007874 International inches, but 39.37 US Survey inches. It may not be obvious, but 'inches'/'Inch' in OpenLayers means US Survey inch, and 'IInch' means International inch). This change also fixes offsets caused by incorrect resolution calculations in OpenLayers.Format.WMTSCapabilities.
This commit is contained in:
@@ -962,8 +962,8 @@ OpenLayers.INCHES_PER_UNIT = {
|
||||
'inches': 1.0,
|
||||
'ft': 12.0,
|
||||
'mi': 63360.0,
|
||||
'm': 39.3701,
|
||||
'km': 39370.1,
|
||||
'm': 39.37,
|
||||
'km': 39370,
|
||||
'dd': 4374754,
|
||||
'yd': 36
|
||||
};
|
||||
|
||||
@@ -706,6 +706,12 @@
|
||||
t.ok(OpenLayers.String.startsWith(id, "chicken"),
|
||||
"OpenLayers.Util.createUniqueID starts id correctly");
|
||||
}
|
||||
|
||||
function test_units(t) {
|
||||
t.plan(2);
|
||||
t.eq(OpenLayers.INCHES_PER_UNIT.m, OpenLayers.INCHES_PER_UNIT.Meter, 'Same inches per m and Meters');
|
||||
t.eq(OpenLayers.INCHES_PER_UNIT.km, OpenLayers.INCHES_PER_UNIT.Kilometer, 'Same inches per km and Kilometers');
|
||||
}
|
||||
|
||||
function test_Util_normalizeScale(t) {
|
||||
t.plan(2);
|
||||
@@ -728,7 +734,7 @@
|
||||
|
||||
var scale = 1/150000000;
|
||||
var resolution = OpenLayers.Util.getResolutionFromScale(scale, 'm');
|
||||
t.eq(resolution.toFixed(6), "52916.638092", "Calculated correct resolution for " + scale);
|
||||
t.eq(resolution.toFixed(6), "52916.772500", "Calculated correct resolution for " + scale);
|
||||
|
||||
scale = 150000000;
|
||||
resolution = OpenLayers.Util.getResolutionFromScale(scale);
|
||||
|
||||
Reference in New Issue
Block a user