Select to view content in your preferred language

Transparent features in ArcGISDynamicMapServiceLayer

1537
6
Jump to solution
10-09-2014 04:14 AM
deleted-user-FIIGSkDYOcdf
Deactivated User

Hello. I have a dynamic layer that has some transparent polygons as come from the MXD, The transparency is working perfectly fine in the Portal for ArcGIS, but when using the ArcGIS JavaScript viewer it is showing the polygons filled with solid color. Please help! (The imageTransparecny is set to false).

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Osama,

  No this is not a bug in the API. The thing is that you are using an ArcGISDynamicMapServiceLayer which is just returned to the API from the server as an image and not individual sublayers. So this means that you can not by default set the transparency for one or more specific sublayer in this map service. But you can go this if your ArcGIS Server is 10.1 or greater by using ImageParameters and LayerDarwingOptions.

Here is the updated Fiddle

View solution in original post

0 Kudos
6 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Osama,

You will need to set the transparency using the opacity property.  Ex:


var layer = new ArcGISDynamicMapServiceLayer(layerUrl, {
    "opacity": 0.5
  });

0 Kudos
deleted-user-FIIGSkDYOcdf
Deactivated User

Thanks Jake for the quick respond. setting the opacity will affect the whole layer. I just need to load the layer as seen in the arcmap.

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Using the setVisibility property, you can choose which layers to show with the ArcGISDynamicMapServiceLayer.  So, you can add this class twice, one for all the layers that will not be transparent, and another for the one that needs transparency applied. 

Take a look at this JS Fiddle for an example.

0 Kudos
deleted-user-FIIGSkDYOcdf
Deactivated User

The problem is that in my case I have all the layers in one service. and I have a large number of layers.

Is there a bug with the Javascript API with layers with transparency?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Osama,

  No this is not a bug in the API. The thing is that you are using an ArcGISDynamicMapServiceLayer which is just returned to the API from the server as an image and not individual sublayers. So this means that you can not by default set the transparency for one or more specific sublayer in this map service. But you can go this if your ArcGIS Server is 10.1 or greater by using ImageParameters and LayerDarwingOptions.

Here is the updated Fiddle

0 Kudos
deleted-user-FIIGSkDYOcdf
Deactivated User

Thank you Robert, Using the image Parameters fixed the problem.

0 Kudos