[GIS] Setting options for individual layers within ArcGIS Server Map Service

arcgis-javascript-apiarcgis-serverjavascriptmap-service

I've been working on an internet mapping site to include Esri basemap layers, and in-house map services broken out by layer.

I am also still fairly new to javascript so this might be a javascript question.

Here is the code for the mapservice and the layers I am accessing.

var patLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://gis.co.frederick.va.us/ArcGIS/rest/services/Planning/Planning_PAT/MapServer",{id:'PAT',opacity:.6});
    patLayer.setVisibleLayers([7,6,1,2,3,4]);
    legendLayers.push({layer:patLayer,title:'Planning Layers'});

What I am not sure of is how to set the options only for specific layers and not just the entire map service e.g.opacity?

Best Answer

With a dynamic map service layer, you cannot specify opacity for individual layers. You can specify visible layers and queries on individual layers but you can only set opacity for the entire map service. See the documentation for specifics: ArcGISDynamicMapServiceLayer.