diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1_1.js b/lib/OpenLayers/Format/WMSCapabilities/v1_1.js
index 8ea5664e53..56e218ebac 100644
--- a/lib/OpenLayers/Format/WMSCapabilities/v1_1.js
+++ b/lib/OpenLayers/Format/WMSCapabilities/v1_1.js
@@ -184,10 +184,10 @@ OpenLayers.Format.WMSCapabilities.v1_1 = OpenLayers.Class(
var rad2 = Math.pow(2, 0.5);
var ipm = OpenLayers.INCHES_PER_UNIT["m"];
layer.maxScale = parseFloat(
- ((rad2 * min) * ipm * OpenLayers.DOTS_PER_INCH).toPrecision(13)
+ ((min / rad2) * ipm * OpenLayers.DOTS_PER_INCH).toPrecision(13)
);
layer.minScale = parseFloat(
- ((rad2 * max) * ipm * OpenLayers.DOTS_PER_INCH).toPrecision(13)
+ ((max / rad2) * ipm * OpenLayers.DOTS_PER_INCH).toPrecision(13)
);
},
@@ -311,4 +311,4 @@ OpenLayers.Format.WMSCapabilities.v1_1 = OpenLayers.Class(
CLASS_NAME: "OpenLayers.Format.WMSCapabilities.v1_1"
-});
\ No newline at end of file
+});
diff --git a/tests/Format/WMSCapabilities/v1_1_1.html b/tests/Format/WMSCapabilities/v1_1_1.html
index e0712c464c..b35a0cb5ca 100644
--- a/tests/Format/WMSCapabilities/v1_1_1.html
+++ b/tests/Format/WMSCapabilities/v1_1_1.html
@@ -54,13 +54,25 @@
}
function test_ogc(t) {
- t.plan(12)
+ t.plan(14)
+
+ /*
+ * Set up
+ */
+ // needed for the minScale/maxScale test, see below
+ var dpi = OpenLayers.DOTS_PER_INCH;
+ OpenLayers.DOTS_PER_INCH = 90.71;
+
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
var obj = new OpenLayers.Format.WMSCapabilities().read(doc);
var capability = obj.capability;
+
+ /*
+ * Test
+ */
var attribution = capability.layers[2].attribution;
t.eq(attribution.title, "State College University", "attribution title parsed correctly.");
@@ -79,6 +91,28 @@
t.eq(metadataURLs[0].type, "FGDC", "type parsed correctly.");
t.eq(metadataURLs[0].format, "text/plain", "format parsed correctly.");
t.eq(metadataURLs[0].href, "http://www.university.edu/metadata/roads.txt", "href parsed correctly.");
+
+ /*
+ Test minScale and maxScale
+
+ For Mapserver
+
+
+
+ corresponds to (RESOLUTION keyword in MAP file has value of 90.71):
+
+ MAXSCALE 250000
+ MINSCALE 1000
+
+ */
+ t.eq(capability.layers[0].minScale, 250000, "layer.minScale is correct");
+ t.eq(capability.layers[0].maxScale, 1000, "layer.maxScale is correct");
+
+ /*
+ * Tear down
+ */
+
+ OpenLayers.DOTS_PER_INCH = dpi;
}
@@ -310,6 +344,7 @@ Changes:
+
RIVERS_1M