diff --git a/lib/OpenLayers/Format/WMC/v1_1_0.js b/lib/OpenLayers/Format/WMC/v1_1_0.js index 0ba65b3fb5..17bd86c18d 100644 --- a/lib/OpenLayers/Format/WMC/v1_1_0.js +++ b/lib/OpenLayers/Format/WMC/v1_1_0.js @@ -89,17 +89,23 @@ OpenLayers.Format.WMC.v1_1_0 = OpenLayers.Class( ); // min/max scale denominator elements go before the 4th element in v1 - var minSD = this.createElementNS( - this.namespaces.sld, "sld:MinScaleDenominator" - ); - minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(10))); - node.insertBefore(minSD, node.childNodes[3]); + if(layer.options.resolutions || layer.options.scales || + layer.options.minResolution || layer.options.maxScale) { + var minSD = this.createElementNS( + this.namespaces.sld, "sld:MinScaleDenominator" + ); + minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(10))); + node.insertBefore(minSD, node.childNodes[3]); + } - var maxSD = this.createElementNS( - this.namespaces.sld, "sld:MaxScaleDenominator" - ); - maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(10))); - node.insertBefore(maxSD, node.childNodes[4]); + if(layer.options.resolutions || layer.options.scales || + layer.options.maxResolution || layer.options.minScale) { + var maxSD = this.createElementNS( + this.namespaces.sld, "sld:MaxScaleDenominator" + ); + maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(10))); + node.insertBefore(maxSD, node.childNodes[4]); + } return node; diff --git a/tests/Format/WMC/test_v1_1_0.html b/tests/Format/WMC/test_v1_1_0.html new file mode 100644 index 0000000000..8e43b99b85 --- /dev/null +++ b/tests/Format/WMC/test_v1_1_0.html @@ -0,0 +1,74 @@ + + + + + + +
+ + diff --git a/tests/list-tests.html b/tests/list-tests.html index bd942653f6..0495a619fa 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -31,6 +31,7 @@
  • Format/test_SLD.html
  • Format/test_WKT.html
  • Format/test_WMC.html
  • +
  • Format/WMC/test_v1_1_0.html
  • Format/test_XML.html
  • test_Icon.html
  • test_Marker.html