AnsweredAssumed Answered

Set scale for each sublayer in ArcGISDynamicMapServiceLayer

Question asked by endlessdsire on Mar 2, 2017
Latest reply on Mar 3, 2017 by endlessdsire

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)

 

var myLayer = new ArcGISDynamicMapServiceLayer(layers.read_dynamic_ap(),{});
myLayer .setImageFormat("png32");
var layerDefinitions = [];
layerDefinitions[0] = "country= '"+ this.state.country[0].queryName+"'";
layerDefinitions[1] = "country= '"+ this.state.country[0].queryName+"'";
layerDefinitions[2] = "country= '"+ this.state.country[0].queryName+"'";
layerDefinitions[4] = "country = '"+ this.state.country[0].queryName+"'";
myLayer .setLayerDefinitions(layerDefinitions);
mapp.addLayer(myLayer );

 

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!

Outcomes