When creating services with ArcGIS Server, I have paid attention to the warning that Layer Transparency will make response time slower and that I should change to color transparency instead so I have been changing it when I "share" the service. Maybe I'm not doing this correctly because I'm not getting the result that I want or maybe I need to ignore the warning.
Currently all my layers are in the same service and I can set opacity to some value 0.5 (and/or can set it individually for different layers e.g. just the layer on top) but the layers on top still cover layers on the bottom. I'd like to see the parcel boundaries underneath the other polygon layers.
mylayer[2].setOpacity(0.1);
Even if I set layer 2 to something almost invisible (like 0.1 as shown in code above; and as rendered below) it covers the parcels underneath (see parcel 0353 in the screenshot below). How should I be doing this instead? Do I need to ignore the warning?
enter image description here
2 Answers 2
By default, the image format for a dynamic map service is PNG24, which doesn't include an alpha band.
To enable transparency, you will need to pass in some additional options when constructing the dynamic layer in your JavaScript code:
var imageParameters = new ImageParameters();
imageParameters.format = "png32";
var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(yourMapServiceURL,{"imageParameters":imageParameters});
edit: There are other image formats that support transparency besides PNG32.
-
Thanks for your answer. That bit of code isn't helping though it still looks like the screenshot in my question. var myLayer = new ArcGISDynamicMapServiceLayer("xxx.xxxxxxxx.org:6080/arcgis/rest/services/LAYER/Folder/...;, {"imageParameters": imageParameters, opacity: 0.45, format: "png32"}); imageParameters.format = "png32"; map.addLayer(myLayer);jbchurchill– jbchurchill2014年09月04日 13:39:05 +00:00Commented Sep 4, 2014 at 13:39
-
1Thank you for your answer. Without passing this, none of my dynamic map services were pulling from the transparency set in MXD. Passing this parameter enabled that.Conor– Conor2015年07月14日 15:02:29 +00:00Commented Jul 14, 2015 at 15:02
I realized that another service I created was working the way I expected so I compared the two mxds. Apparently when I created the service that had the problem, I had turned the layer transparency off under the layer properties. In the service that was working as expected, it was still set to 60% transparent but I had changed it to use color transparency instead of layer transparency in the "Analyze" section of the "Share as Service" wizard.
Explore related questions
See similar questions with these tags.