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});
    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?


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.

  • I was afraid of that. If I wanted to do that would I have to use something other than a dyanamic mapservice layer? – Not to be named Oct 8 '10 at 13:47
  • Yes, you can only change the opacity of an entire map service via the JS API. How many layers are you dealing with? – Derek Swingley Oct 8 '10 at 14:05
  • Any updates or suggestions on this? I am dealing with a similar issue where I have a dynamic map service layer with 10-15 sub layers. What would be a better solution if I want to have multiple layers and control their opacities? – jotamon Mar 7 '13 at 14:50

Your Answer

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