3

I am new to programming in JSAPI.

I have two dynamic layers and I want to set the property setMinScale(scale) and setMaxScale(scale) to layers so how do I Set ?

ex. I tried using layer.setMinScale(0) but it is not working

1 Answer 1

2

it have to be maxScale or minScale for your layer defination as following example. more info is on arcgis javascript doc. site....

maxScale

The maximum visible scale for each layer in the map service. If the map is zoomed in beyond this scale the layer will not be visible. A value of 0 means that the layer does not have a maximum scale. This property is only available for map services published using ArcGIS Server 10 SP1 or later. Code snippets:

dynamicLayerInfo.maxScale = 1000000;

dynamicLayerInfo.minScale = 0;

.

minScale

The minimum visible scale for each layer in the map service. If the map is zoomed out beyond this scale the layer will not be visible. A value of 0 means that the layer does not have a minimum scale. This property is only available for map services published using ArcGIS Server 10 SP1 or later. Code snippets:

dynamicLayerInfo.maxScale = 1000000;

dynamicLayerInfo.minScale = 0;

i hope it helps you...

3
  • Hi Aragon, thanks for your reply. I tried according to API doc. layer1.maxScale = 1000000; layer1.minScale = 0; also check the REST link for scale its showing minimum scale 1.47914381 & max. scale is 4513.988 Let me add code here
    – Sunil
    Commented Oct 17, 2012 at 8:12
  • var dynamicMapServiceLayer1 = new esri.layers.ArcGISDynamicMapServiceLayer("myserver:6080/arcgis/rest/services/layer11/MapServer",{"opacity":0.25}); dynamicMapServiceLayer1.setVisibleLayers([0,1]); dynamicMapServiceLayer1.maxScale = 50000; dynamicMapServiceLayer1.minScale = 0; map.addLayer(dynamicMapServiceLayer1); // Is my code is wrong ??.. please let me know.. thanks
    – Sunil
    Commented Oct 17, 2012 at 8:20
  • Hello All, Its resolved . I have customized my code as per instructions given by @Argon thanks Argon..Please check following link also forums.arcgis.com/threads/…
    – Sunil
    Commented Oct 18, 2012 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.