Merge pull request #807 from ahocevar/units

WMTS Example misaligning with OSM base layer. r=@sbrunner
This commit is contained in:
ahocevar
2012-12-20 14:35:57 -08:00
4 changed files with 15 additions and 9 deletions
+2 -2
View File
@@ -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
};
+2 -2
View File
@@ -340,7 +340,7 @@
// needed for the minScale/maxScale test, see below
var dpi = OpenLayers.DOTS_PER_INCH;
OpenLayers.DOTS_PER_INCH = 90.71;
OpenLayers.DOTS_PER_INCH = 90.710230403857;
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
@@ -377,7 +377,7 @@
<ScaleHint min="0.395998292216226" max="98.9995730540565" />
corresponds to (RESOLUTION keyword in MAP file has value of 90.71):
corresponds to (RESOLUTION keyword in MAP file has value of 90.710230403857):
MAXSCALE 250000
MINSCALE 1000
+4 -4
View File
@@ -400,13 +400,13 @@
[0.0012699126752168362, 0.0006349563376084181, 0.00031747816880420905], 0.00031747816880420905, 0.0012699126752168362
], [
"1.18", null, {scales: [400000, 200000, 100000], units: "m"},
[141.11103491115225, 70.55551745557612, 35.27775872778806], 35.27775872778806, 141.11103491115225
[141.11139333389778, 70.55569666694889, 35.277848333474445], 35.277848333474445, 141.11139333389778
], [
"1.19", null, {minScale: 400000, numZoomLevels: 3, units: "m"},
[141.11103491115225, 70.55551745557612, 35.27775872778806], 35.27775872778806, 141.11103491115225
[141.11139333389778, 70.55569666694889, 35.277848333474445], 35.277848333474445, 141.11139333389778
], [
"1.20", null, {maxScale: 100000, numZoomLevels: 3, units: "m"},
[141.11103491115225, 70.55551745557612, 35.27775872778806], 35.27775872778806, 141.11103491115225
[141.11139333389778, 70.55569666694889, 35.277848333474445], 35.277848333474445, 141.11139333389778
], [
"1.21", null, {numZoomLevels: 2}, // maxResolution calculated based on the projection's maxExtent here
[1.40625, 0.703125], 0.703125, 1.40625
@@ -519,7 +519,7 @@
[0.0012699126752168362, 0.0006349563376084181, 0.00031747816880420905], 0.00031747816880420905, 0.0012699126752168362
], [
"2.5.4", {units: "m"}, {scales: [400000, 200000, 100000]},
[141.11103491115225, 70.55551745557612, 35.27775872778806], 35.27775872778806, 141.11103491115225
[141.11139333389778, 70.55569666694889, 35.277848333474445], 35.277848333474445, 141.11139333389778
], [
/*
* Batch 2.6: minScale set in the layer options
+7 -1
View File
@@ -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);