Hi, whenever I want to display a Vector Layer in a scale range I always add Rules to my mapStyle.<div><div>I modify your code to achive this.</div><div><br></div><div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<span class="webkit-javascript-keyword" style="color:rgb(170,13,145)"><span class="webkit-javascript-keyword" style><br></span></span></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<span class="webkit-javascript-keyword" style><span class="webkit-javascript-keyword" style><div class="webkit-line-content" style="padding-left:2px;color:rgb(0,0,0)"><span class="webkit-javascript-keyword" style="color:rgb(170,13,145)">var</span> <span class="webkit-javascript-ident" style>defaultStyle</span> = <span class="webkit-javascript-keyword" style="color:rgb(170,13,145)">new</span> <span class="webkit-javascript-ident" style>OpenLayers</span>.<span class="webkit-javascript-ident" style>Style</span>();</div>
<div class="webkit-line-content" style="padding-left:2px"><div class="webkit-line-content" style="color:rgb(0,0,0);padding-left:2px"><span class="webkit-javascript-keyword" style="color:rgb(170,13,145)"><br></span></div><div class="webkit-line-content" style="color:rgb(0,0,0);padding-left:2px">
<span class="webkit-javascript-keyword" style="color:rgb(170,13,145)">var</span> template = {<span class="webkit-javascript-string" style="color:rgb(196,26,22)">'pointRadius'</span>: <span class="webkit-javascript-number" style="color:rgb(28,0,207)">10</span>,</div>
<div class="webkit-line-content" style="color:rgb(0,0,0);padding-left:2px"> <span class="webkit-javascript-string" style="color:rgb(196,26,22)">'externalGraphic'</span>: <span class="webkit-javascript-string" style="color:rgb(196,26,22)">'png/symboly/plastAlpha.png'</span></div>
<div class="webkit-line-content" style="color:rgb(0,0,0);padding-left:2px"> };</div></div></span></span></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<span class="webkit-javascript-keyword" style="color:rgb(170,13,145)"><br></span></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<span class="webkit-javascript-keyword" style="color:rgb(170,13,145)">var</span> <span class="webkit-javascript-ident" style>rule</span> = <span class="webkit-javascript-keyword" style="color:rgb(170,13,145)">new</span> <span class="webkit-javascript-ident" style>OpenLayers</span>.<span class="webkit-javascript-ident" style>Rule</span>();</div>
<div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)"><span class="webkit-javascript-ident" style>rule</span>[<span class="webkit-javascript-string" style="color:rgb(196,26,22)">"minScaleDenominator"</span>] = <span class="webkit-javascript-number" style="color:rgb(28,0,207)">60000</span>;</div>
<div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)"><span class="webkit-javascript-ident" style>rule</span>[<span class="webkit-javascript-string" style="color:rgb(196,26,22)">"maxScaleDenominator"</span>] = <span class="webkit-javascript-number" style="color:rgb(28,0,207)">10000</span>;</div>
<div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)"><span class="webkit-javascript-ident" style>rule</span>[<span class="webkit-javascript-string" style="color:rgb(196,26,22)">"symbolizer"</span>] = <span class="webkit-javascript-ident" style>template</span>;</div>
<div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">defaultStyle.<span class="webkit-javascript-ident" style>addRules</span>([ <span class="webkit-javascript-ident" style>rule</span> ]);</div>
<div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)"><br></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<span class="webkit-javascript-keyword" style="color:rgb(170,13,145)">var</span> <span class="webkit-javascript-ident" style>styleKontiky</span> = <span class="webkit-javascript-keyword" style="color:rgb(170,13,145)">new</span> <span class="webkit-javascript-ident" style>OpenLayers</span>.<span class="webkit-javascript-ident" style>StyleMap</span>({<span class="webkit-javascript-string" style="color:rgb(196,26,22)">'default'</span>: <span class="webkit-javascript-ident" style>defaultStyle</span>, <span class="webkit-javascript-string" style="color:rgb(196,26,22)">'select'</span>: <span class="webkit-javascript-ident" style>selectStyle</span>});</div>
<div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)"><br></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<span style="font-family:arial;line-height:normal;white-space:normal;font-size:small">Hope it's usefull.</span></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<span style="font-family:arial;line-height:normal;white-space:normal;font-size:small">Regards</span></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<span style="font-family:arial;line-height:normal;white-space:normal;font-size:small">Nacho</span></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)">
<br></div><div class="webkit-line-content" style="padding-left:2px;font-family:'dejavu sans mono',monospace;font-size:11px;line-height:13px;white-space:pre;background-color:rgb(255,255,255)"><br></div><div class="gmail_quote">
On Sat, Jan 21, 2012 at 5:25 PM, vrbikdan <span dir="ltr"><<a href="mailto:vrbikdan@gmail.com">vrbikdan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
I'm trying to set min and max scale for layer. I used this part of code:<br>
<br>
kontiky_layer = new OpenLayers.Layer.GML("GML",<br>
"kontikyVrstva/kontikyFinalGML.gml", {projection: map.displayProjection,<br>
styleMap: styleKontiky},{minScale: 60000, maxScale: 10000})<br>
<br>
But unfortunately layer is still visible in all scales. Whole map with code<br>
is here: <a href="http://vrbikdan.xf.cz/kontiky/kontiky.html" target="_blank">http://vrbikdan.xf.cz/kontiky/kontiky.html</a><br>
<a href="http://vrbikdan.xf.cz/kontiky/kontiky.html" target="_blank">http://vrbikdan.xf.cz/kontiky/kontiky.html</a> . Can you tell me what is wrong?<br>
<br>
Thanks,<br>
Dan<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/minScale-maxScale-doesn-t-work-tp7211677p7211677.html" target="_blank">http://osgeo-org.1803224.n2.nabble.com/minScale-maxScale-doesn-t-work-tp7211677p7211677.html</a><br>
Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</font></span></blockquote></div><br></div></div>