[OpenLayers-Users] Min/MaxScale problem

gabriel gpetricek at gmail.com
Wed Mar 20 05:36:26 PDT 2013


Hi List, 

i got this problem. Im trying dynamically change min and maxscale for
layers. So for start i set maxScale=100000. 
var layer = new o.Layer.WMS(name, url, {params},{...maxScale:100000,
minScale:500000});

Then i add value 150000

/*button onclick event*/
layer.maxScale = document.getElementById("maxScale_value").value; //150000;

OK , everything works fine. I can see layer from scale 500K to scale 150K. 
But when i change the value less then maxScale. for example to 50 000, it
doesnt work. i can see layer from 500K to 100K. 

Then i tried something like this: 
var layer = new o.Layer.WMS(name, url, {params}); // without max/minScale

map.events.register("move", map, function(){
 if(layer.maxScale == 500) // this is the default maxScale value
 {
   layer.maxScale = 100000;
   layer.minScale = 500000;
 }
})

and then the same button click event

layer.maxScale = document.getElementById("maxScale_value").value; //50000;

That is working for me. But there is another new problem. If i have layer in
scales from 100000 to 500000 and i zoom to scale 525000 i cant see the layer
(that's good), but when i launch browser console (F12), in Network list i
can see, that the layer is still loaded in background.

Any idea how to avoid this problem? 

Best regards. 




--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Min-MaxScale-problem-tp5041701.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list