<div>I don&#39;t know if this will help you or not either but here is what I do.&nbsp; I have a layer that is identified as dm_wms.</div>
<div>&nbsp;</div>
<div><font size="2">
<p>map.events.register(</p></font><font color="#800000" size="2">&#39;moveend&#39;</font><font size="2">, map, </font><font color="#0000ff" size="2">function</font><font size="2"> (e) {</font><font size="2">
<p>&nbsp;&nbsp;&nbsp; myScale = (map.getMaxResolution() / map.getResolution());</p></font><font size="2">
<p></p></font><font color="#0000ff" size="2">&nbsp;&nbsp;&nbsp; if</font><font size="2"> (myScale &gt;= 1024) {
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dm_wms.setVisibility(</p></font><font color="#0000ff" size="2">true</font><font size="2">);</font><font size="2">
<p>&nbsp;&nbsp;&nbsp; } </p></font><font color="#0000ff" size="2">else</font><font size="2"> {
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dm_wms.setVisibility(</p></font><font color="#0000ff" size="2">false</font><font size="2">);</font><font size="2">
<p>&nbsp;&nbsp;&nbsp; }</p>
<p>}</p></font>Linda Rawson<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 9/13/07, <b class="gmail_sendername">bradleyspencer</b> &lt;<a href="mailto:brad@cubewerx.com.au">brad@cubewerx.com.au</a>&gt; 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&#39;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(&#39;zoomend&#39;, null, function(evt)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var macroCheckBox = document.getElementById(&#39;macro&#39;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zmlevel= map.getZoom();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // run through the layer controls array setting Checkbox to deactive
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (j=0; j&lt;numLayers; j++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var layId= &#39;layer&#39;+j;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var layerCheckbox = document.getElementById(layId)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if the layer is viewable at this layer set the checkbox to reflect
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Event.stop(evt);<br>&nbsp;&nbsp; });<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>&gt;<br>&gt; Hi again,<br>&gt;<br>&gt; I tried as you suggest,&nbsp;&nbsp;as<br>&gt;<br>&gt; which is @ <a href="http://prasad.choudhary.googlepages.com/markers.html">
http://prasad.choudhary.googlepages.com/markers.html</a><br>&gt; but still, not happening, is there some thing i missed out? please correct<br>&gt; me.<br><br>The minResolution of the markers layer is not respecting the value you
<br>passed in. I can&#39;t see why this is at the moment, but it seems to be a<br>bug. When I get time, I&#39;ll look into it -- for now, something like this<br>will work:<br><br>var markers = new OpenLayers.Layer.Markers
(<br>&nbsp;&nbsp;&nbsp;&nbsp;&quot;Markers&quot;,{&#39;minResolution&#39;: 0.3515625, &#39;maxResolution&#39;: 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>