I have several layers on my map. I need to set minimum and maximum scale level to prevent zooming. What's the best way of implementing it?


There are multiple ways you could set an use the Minimum & Maximum Zoom levels:

  1. As Jaimie has mentioned in the other answer, you could set the LODS for the map and then your map could only be viewed at those particular zoom Levels. This sample shows how you can set the LODs. The disadvantage of this is that yor map can only be used in particular zoom levels, and dynamic zooming into an arbitrary scale would not be possible.

  2. You could listen to the Map's ZoomEnd event, and then stop the zooming, if it is beyond your required range.

  3. You could set the max & minimum scale levels on the map service itself. this might not be possible in all cases, but it's the best option, since your data is not exposed at the REST endpoint itself. This is the most secure.

  • Thanks. Unfortunately I don't have access to services. I've thought already of 2nd method, but extent and scale are not updated yet by that moment – Timofei Davydik Feb 19 '13 at 15:03
  • I've listened to ZoomEnd event, and then checked new scale. Thanks anyway – Timofei Davydik Feb 21 '13 at 8:41
  • Is there any specific reason why you selected ZoomEnd rather than ZoomStart event? The advantage of the former is that you can stop the zoom from happening itself. In the case of ZoomEnd, The map for the new zoom level is requested and only once you have the new extent, will you check. This gives a sort of 'Bouncing effect' IMHO. – Devdatta Tengshe Feb 21 '13 at 8:54
  • as I mentioned before, I can't get new scale and extent on ZoomStart event. These values are not changed yet by that moment. But on ZoomEnd I can get updated extent and scale. So I just denied animation setting zoomDuration to 0, so it looks ok now :) – Timofei Davydik Feb 21 '13 at 9:38
  • Ok.. Got it. I agree that your way is better. – Devdatta Tengshe Feb 21 '13 at 9:51

From what I could find and know you will want to define the Levels of Detail (LOD) for the flex application. Here is the ESRI documentation and you should look at the live sample on the page called: "Settting LODs for the map manually".


This approach will be somewhat limited as you want to align your scale levels with the levels present in the tiled basemap you are using. If you are not using a tiled basemap then You should also be able to define the min/max in your MXD so when you publish that is what is only available. That should be found in "Document Properties" if my memory serves me correctly.

Added Info

So it looks like since you are not using a tiled service and do not have access to the ags services that you should probably set an initial extent on the dynamic service to be inside the scale range that you want. Then do as suggested below and listen to the zoom events and check to see if the user is within your scale. If not, then do not zoom.

  • As stated, I normally set my LOD in the mxd. actually in each layer property though. on the general tab you will find "do not show out beyond" and "do not show in beyond" – Brad Nesom Feb 19 '13 at 14:52
  • Thanks for the reply. I'm using ArcGISDynamicMapServiceLayer and FeatureLayer, and I have no access to services. Can I do something on the client side? – Timofei Davydik Feb 19 '13 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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