<div>I don't know if this will help you or not either but here is what I do. I have a layer that is identified as dm_wms.</div>
<div> </div>
<div><font size="2">
<p>map.events.register(</p></font><font color="#800000" size="2">'moveend'</font><font size="2">, map, </font><font color="#0000ff" size="2">function</font><font size="2"> (e) {</font><font size="2">
<p> myScale = (map.getMaxResolution() / map.getResolution());</p></font><font size="2">
<p></p></font><font color="#0000ff" size="2"> if</font><font size="2"> (myScale >= 1024) {
<p> dm_wms.setVisibility(</p></font><font color="#0000ff" size="2">true</font><font size="2">);</font><font size="2">
<p> } </p></font><font color="#0000ff" size="2">else</font><font size="2"> {
<p> dm_wms.setVisibility(</p></font><font color="#0000ff" size="2">false</font><font size="2">);</font><font size="2">
<p> }</p>
<p>}</p></font>Linda Rawson<br><br> </div>
<div><span class="gmail_quote">On 9/13/07, <b class="gmail_sendername">bradleyspencer</b> <<a href="mailto:brad@cubewerx.com.au">brad@cubewerx.com.au</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Prasad,<br><br>I'm not sure if this will help as I do not use the resolutions that much<br>(probably should?).
<br><br>Anyway, I set up an event that is triggered every time there is a zoom<br>change. Then I can check the new zoom level and if the layer should be<br>displayed at that layer I do something like turning it on or off. Of course
<br>it requires me to have arrays of display level thresholds for each layer -<br>this I do in an application config file at load time.<br><br>See <a href="http://www.ozdemo.org">http://www.ozdemo.org</a> as a working example. Hope this can help you.
<br><br>map.events.register('zoomend', null, function(evt)<br> {<br> var macroCheckBox = document.getElementById('macro');<br> zmlevel= map.getZoom();<br> // run through the layer controls array setting Checkbox to deactive
<br> for (j=0; j<numLayers; j++)<br> {<br> var layId= 'layer'+j;<br> var layerCheckbox = document.getElementById(layId)<br><br> // if the layer is viewable at this layer set the checkbox to reflect
<br> if (zmlevel < Minzm[j] || zmlevel > Maxzm[j])<br> { layerCheckbox.disabled = true;<br> layerCheckbox.checked=false;<br> layerVisibility(layId);
<br> }<br> else<br> { layerCheckbox.disabled = false;<br> if (macroCheckBox.checked)<br> {
<br> layerCheckbox.checked= true;<br> layerVisibility(layId);<br> }<br><br> }<br> }
<br> Event.stop(evt);<br> });<br><br>Cheers,<br><br>Brad Spencer<br>-----Original Message-----<br>From: <a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a> [mailto:<a href="mailto:users-bounces@openlayers.org">
users-bounces@openlayers.org</a>]On<br>Behalf Of Christopher Schmidt<br>Sent: Thursday, 13 September 2007 10:47 PM<br>To: Prasad Choudhary<br>Cc: <a href="mailto:users@openlayers.org">users@openlayers.org</a><br>Subject: Re: [OpenLayers-Users] Layer on/off
<br><br>On Thu, Sep 13, 2007 at 04:26:52AM -0700, Prasad Choudhary wrote:<br>><br>> Hi again,<br>><br>> I tried as you suggest, as<br>><br>> which is @ <a href="http://prasad.choudhary.googlepages.com/markers.html">
http://prasad.choudhary.googlepages.com/markers.html</a><br>> but still, not happening, is there some thing i missed out? please correct<br>> me.<br><br>The minResolution of the markers layer is not respecting the value you
<br>passed in. I can't see why this is at the moment, but it seems to be a<br>bug. When I get time, I'll look into it -- for now, something like this<br>will work:<br><br>var markers = new OpenLayers.Layer.Markers
(<br> "Markers",{'minResolution': 0.3515625, 'maxResolution': 1.40625} );<br>map.addLayer(markers);<br>markers.minResolution = .35;<br><br>Regards,<br>--<br>Christopher Schmidt<br>MetaCarta<br>
_______________________________________________<br>Users mailing list<br><a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br><a href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users
</a><br><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br><a href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users
</a><br></blockquote></div><br>