Hello there,
Im trying to see how can i set the layer scale in a ArcGISDynamicMapServiceLayer. I have a service with this kind of url
services/mycitycity/MapServer which contains 3 sublayers: cars, streets, people.
So i did this code for adding the layer to a map (im using es6)
<SPAN class="keyword token">var</SPAN> myLayer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ArcGISDynamicMapServiceLayer</SPAN><SPAN class="punctuation token">(</SPAN>layers<SPAN class="punctuation token">.</SPAN><SPAN class="token function">read_dynamic_ap</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
myLayer <SPAN class="punctuation token">.</SPAN><SPAN class="token function">setImageFormat</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"png32"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> layerDefinitions <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
layerDefinitions<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="string token">"country= '"</SPAN><SPAN class="operator token">+</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>state<SPAN class="punctuation token">.</SPAN>country<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>queryName<SPAN class="operator token">+</SPAN><SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">;</SPAN>
layerDefinitions<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="string token">"country= '"</SPAN><SPAN class="operator token">+</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>state<SPAN class="punctuation token">.</SPAN>country<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>queryName<SPAN class="operator token">+</SPAN><SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">;</SPAN>
layerDefinitions<SPAN class="punctuation token">[</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="string token">"country= '"</SPAN><SPAN class="operator token">+</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>state<SPAN class="punctuation token">.</SPAN>country<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>queryName<SPAN class="operator token">+</SPAN><SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">;</SPAN>
layerDefinitions<SPAN class="punctuation token">[</SPAN><SPAN class="number token">4</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="string token">"country = '"</SPAN><SPAN class="operator token">+</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>state<SPAN class="punctuation token">.</SPAN>country<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>queryName<SPAN class="operator token">+</SPAN><SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">;</SPAN>
myLayer <SPAN class="punctuation token">.</SPAN><SPAN class="token function">setLayerDefinitions</SPAN><SPAN class="punctuation token">(</SPAN>layerDefinitions<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
mapp<SPAN class="punctuation token">.</SPAN><SPAN class="token function">addLayer</SPAN><SPAN class="punctuation token">(</SPAN>myLayer <SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>So when i see the layers on the map, its ok, but i want to show them in a different scale every one due to one of them contains too much data, and when u see it from afar, i get this:

I dont know if i should separate each dynamic layer and add them using mapp.addLayers(dynLayer1,dynLayer2,dynLayer3) or how to set the scale separately.
Also i want to know how can i put the visibility on and off for each one in case i need to separate them.
Any example code should be great.
I have been looking this websites:
ArcGIS API for JavaScript Sandbox : cuz the main reason im changing the layers to dynamic (i use featured) its about the identify element over there.
ArcGISDynamicMapServiceLayer | API Reference | ArcGIS API for JavaScript 3.19
Thanks in advice!