Correct handling of 0 and Infinity ScaleHint
minScale and maxScale values of 0 and Infinity do not make sense in OpenLayers, but they are used in WMS GetCapabilities 1.1.1 to indicate that there is no minScale or maxScale restriction. Assuming that the capability values for minScale and maxScale are passed as config options to a WMS layer, it is better to not set minScale and maxScale when 0 or Infinity are found in the ScaleHint.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user