<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 1, 2012, at 4:41 PM, Eric Lemoine wrote:</div><blockquote type="cite">On Friday, June 1, 2012, Charles Galpin  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is probably really simple but I'm drawing a blank.<br>

<br>
I have a OpenLayers.Layer.WMS layer that I want to change a parameter each time it refreshes (on initial load, zoom, explicit refresh, whenever). In case you are curious ultimately I want to pass the map scale as part of  a parameter called "viewparams" which allows one to pass parameters to geoserver sql views. I can send a static value just fine from the value provided for params during construction, but need to make it dynamic.<br>

<br>
So perhaps there is a pre-load event handler I can add to do the equivalent of mergeNewParams say? Thoughts?<br>
<br>
Thanks,</blockquote><div><br></div><div><br></div><div>You can create a Layer.WMS subclass and overload getURL or getFullRequestString. Look at the OL code.<span></span></div></blockquote></div><br><div>Eric, I just wanted to say thanks for the suggestion. This was perfect - I ended up overriding getURL since I had access to the bounds there (used to calculate the scale) and could add my params before the call to getFullRequestString.</div><div><br></div><div>Thanks again,</div><div>charles</div></body></html>