[GIS] How to set different map layers for different zoom levels using ArcGIS JavaScript API

arcgis-javascript-apiarcgis-server

I have created a layer using "clip" tool in ArcMap.

enter image description here

I have another layer in TOC too. whichis the same area in "clip" Layer with more polygons.

enter image description here

In my web map application (javaScript API) Is there any way to set these layers in a way that when I zoom in I get more details like image2 and by zooming out I get polygons in image1.

Best Answer

To change the displayed layer at different scales you should set the scale range. This can either be done on the source data before publishing to ArcGIS server with the layer properties > general > scale range option or can be done in code by setting the Max and Min scales of the layer using SetScaleRange