I have created a small path for WMSLegend.js.  Currently the FORMAT and
SCALE parameters are being added to the URL twice if they are specified as
parameters to the getLegendUrl function.  This patch corrects the code so
that the default values are not appended if the parameters are already
present.

Do I need a Trac account to submit this patch?  I have attached the diff
file below:

Index: WMSLegend.js
===================================================================
--- WMSLegend.js    (revision 725)
+++ WMSLegend.js    (working copy)
@@ -144,23 +144,23 @@
                 TIME: null
             });
         }
+        var params = Ext.apply({}, this.baseParams);
+        if (layer.params._OLSALT) {
+            // update legend after a forced layer redraw
+            params._OLSALT = layer.params._OLSALT;
+        }
+        url = Ext.urlAppend(url, Ext.urlEncode(params));
         if (url.toLowerCase().indexOf("request=getlegendgraphic") != -1) {
             if (url.toLowerCase().indexOf("format=") == -1) {
                 url = Ext.urlAppend(url, "FORMAT=image/gif");
             }
             // add scale parameter - also if we have the url from the
record's
             // styles data field and it is actually a GetLegendGraphic
request.
-            if (this.useScaleParameter === true) {
+            if (this.useScaleParameter === true &&
url.toLowerCase().indexOf("scale=") == -1) {
                 var scale = layer.map.getScale();
                 url = Ext.urlAppend(url, "SCALE=" + scale);
             }
         }
-        var params = Ext.apply({}, this.baseParams);
-        if (layer.params._OLSALT) {
-            // update legend after a forced layer redraw
-            params._OLSALT = layer.params._OLSALT;
-        }
-        url = Ext.urlAppend(url, Ext.urlEncode(params));

         return url;
     },
_______________________________________________
Dev mailing list
Dev@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/dev

Reply via email to