Layer Transparency from Dynamic Map Service

2969
12
12-04-2017 01:45 PM
MichaelThompson
New Contributor III

I have a dynamic Map Service published in AGS with a Transparency value set for a layer. This Transparency value doesn't seem to automatically set the Layer's Opacity property in Runtime and I can't find the layer transparency value in the ServiceInfo in order to set the Opacity using that value. Any ideas?

Tags (1)
0 Kudos
12 Replies
dotMorten_esri
Esri Notable Contributor

A map service doesn't have opacity - only the sublayers within the mapservice. See the REST spec here: http://sampleserver6.arcgisonline.com/arcgis/sdk/rest/index.html#//02ss0000006v000000

Layers inside maps can have opacity, so if you publish a map that has a layer that points to this service, that layer can have opacity, but the service itself cannot.

0 Kudos
AndrewFoster
New Contributor II

We have the same issue using ArcGIS Runtime SDK for .NET v10.2.7 and dynamic map services published in ArcGIS Server v10.5.  The polygon layers that have a transparency value will display with muted colors but do not have any transparency.  I have verified that the transparency value is saved with the map service by browsing the map service Uri and looking at the Drawing Info properties (see below).

Layer: Feeder Boundaries (ID: 104)

Name: Feeder Boundaries 

Display Field: FEEDERNAME 

Type: Feature Layer 

Geometry Type: esriGeometryPolygon 

....

....

Drawing Info:

Renderer:Unique Value Renderer:

....

....

Transparency: 50

....

....

Strangely, the same MXD used to publish the map service in ArcGIS Server will display the transparency correctly when shared as an MPK using a local file geodatabase as the data source.  I sure hope someone has the solution to this problem.

0 Kudos
dotMorten_esri
Esri Notable Contributor

The transparency you're showing is in the drawing info of a _sublayer_, and not the map service itself. That should be respected just fine.

0 Kudos
AndrewFoster
New Contributor II

Morten, I agree.  The transparency of the sublayer should be respected, but it isn't.  Also, since the transparency property of a sublayer is read-only, it can't be changed at runtime; we can only change the transparency of the map service layer which affects all of its sublayers.

0 Kudos
dotMorten_esri
Esri Notable Contributor

The transparency of a sublayer in a dynamic map service is applied by the server, not the runtime.

Which type of runtime layer are you using to access the mapservice? Which image format did you specify?

0 Kudos
AndrewFoster
New Contributor II

We're creating the map layer as an ArcGISDynamicMapServiceLayer. I don't know that we specify the image format. What's the default image format?

0 Kudos
AndrewFoster
New Contributor II

Morten, what's the correct image format and how do we set it on the map service? Andrew Foster

0 Kudos
MichaelThompson
New Contributor III

Morten,

Thank you for participating in this discussion! In my case, my service is a Dynamic service. The sublayer in that service has a transparency value of 80. In Runtime v100.1.0, I am accessing the layer using a ArcGISMapImageLayer class. I didn't specify an ImageFormat originally, but I just tried PNG and the layer does display, but without transparency.

If I add the same service as a layer in ArcMap, the transparency of the sublayer is as expected.

Michael

0 Kudos
dotMorten_esri
Esri Notable Contributor

Just to be clear here: The sublayer is transparent, but if there's any other sublayer behind or in front of it that isn't transparent, the generated image wouldn't have any transparency in it.

You could try and use Fiddler and see what /exportImage request is made, and what image is coming back.

0 Kudos