To set transparency for an individual layer, I had to enable support for dynamic layer on the map service in ArcGIS Server, set the image format to PNG32 for the dynamic layer --> layer.setImageFormat('png32'); There should be an easier way...
The problem with Jake Skinner's answer is that it will cause 2 requests to the map service every time the user pans, zooms, etc. If you have 24 layers with 24 different transparencies, this can quickly overwhelm a service.
//transparency applied var lyrUSA = new ArcGISDynamicMapServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", { opacity : 0.5 }); lyrUSA.setVisibleLayers([0,2]); map.addLayer(lyrUSA); //no transparency var lyrUSA2 = new ArcGISDynamicMapServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer"); lyrUSA2.setVisibleLayers([1,3]); map.addLayer(lyrUSA2);
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.