diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1_1.js b/lib/OpenLayers/Format/WMSCapabilities/v1_1.js index 8607c612cf..3b4e4883b7 100644 --- a/lib/OpenLayers/Format/WMSCapabilities/v1_1.js +++ b/lib/OpenLayers/Format/WMSCapabilities/v1_1.js @@ -78,14 +78,18 @@ OpenLayers.Format.WMSCapabilities.v1_1 = OpenLayers.Class( var max = node.getAttribute("max"); var rad2 = Math.pow(2, 0.5); var ipm = OpenLayers.INCHES_PER_UNIT["m"]; - obj.maxScale = parseFloat( - ((min / rad2) * ipm * - OpenLayers.DOTS_PER_INCH).toPrecision(13) - ); - obj.minScale = parseFloat( - ((max / rad2) * ipm * - OpenLayers.DOTS_PER_INCH).toPrecision(13) - ); + if (min != 0) { + obj.maxScale = parseFloat( + ((min / rad2) * ipm * + OpenLayers.DOTS_PER_INCH).toPrecision(13) + ); + } + if (max != Number.POSITIVE_INFINITY) { + obj.minScale = parseFloat( + ((max / rad2) * ipm * + OpenLayers.DOTS_PER_INCH).toPrecision(13) + ); + } }, "Dimension": function(node, obj) { var name = node.getAttribute("name").toLowerCase(); diff --git a/tests/Format/WMSCapabilities/v1_1_1.html b/tests/Format/WMSCapabilities/v1_1_1.html index 8309bd75ad..0d044e480c 100644 --- a/tests/Format/WMSCapabilities/v1_1_1.html +++ b/tests/Format/WMSCapabilities/v1_1_1.html @@ -332,7 +332,7 @@ } function test_ogc(t) { - t.plan(14) + t.plan(16) /* * Set up @@ -386,6 +386,8 @@ t.eq(capability.layers[0].minScale, 250000, "layer.minScale is correct"); t.eq(capability.layers[0].maxScale, 1000, "layer.maxScale is correct"); + t.eq(capability.layers[1].minScale, undefined, "layer.minScale for max='Infinity' is correct"); + t.eq(capability.layers[1].maxScale, undefined, "layer.maxScale for min='0' is correct"); /* * Tear down */ @@ -590,8 +592,6 @@ Changes: - - ROADS_1M @@ -641,6 +641,7 @@ Changes: canal waterway +