Select to view content in your preferred language

using LayerDrawingOptions to change opacity of 1 layer in a mapService

1161
4
06-05-2013 08:16 AM
ScottDawson
Emerging Contributor
Hi all,
I may be making this more complicated than it needs to be, but I'd like to be able to change the transparency (same as opacity?) of 1 layer in a map service, while leaving the other layers alone and having them displayed at the opacity defined by the map service.

This is easy to do on all layers served by the service, but with 10.1 server you can specify an individual layer to adjust the opacity.
At least this is my understanding.

I'm getting a bit confused with the type or Renderer (simple?) needed for the LayerDrawingOptions.  Also do I have to set all the symbols, or will it "default" to the existing definitions of the map service?  The map service is defined via an .sd file, so other than a few fixed points (ie. the layer that I want the opacity to change on), I'll have minimal visibility into what else is defined, symbology, etc..

We're running a 10.1 Arcgis server.

So, my questions are:
1) Is my understanding correct on this is how to change opacity of a single layer?
2) Is there a code example I've missed? or a 1,2,3 type how to do it.   I don't mind doing some experimenting, but a kick in the right direction would be helpful.  Again, maybe I'm looking at the examples and making more of it than necessary.
3) I don't need to define all the symbols or anything do I? just set the transparency.

Glad this functionality is there.  Thanks for any help.
0 Kudos
4 Replies
JohnGravois
Deactivated User
the functionality you need to take advantage of is the same as someone who needs to redefine the symbology of one or many layers entirely.  this means you have to create a new layerDrawingOption and assign it the appropriate transparency.

you don't necessarily have to redefine renderers for any layers, but you have to include a layerDrawingOption for any layer that needs to be drawn.

i wrote up a quick fiddle which shows how to pass one layer "as is" and another with a new renderer and transparency set.  you could skip the custom renderer if you wanted....
0 Kudos
BenFousek
Deactivated User
i wrote up a quick fiddle which shows how to pass one layer "as is" and another with a new renderer and transparency set.  you could skip the custom renderer if you wanted....


John - I'd like to see your example but the fiddle is blank.

Thanks, Ben
0 Kudos
JohnGravois
Deactivated User
fixed.  sorry about that.
0 Kudos
GaryPlayer
Deactivated User

Hi John,

I'm having a similar issue to Scott's and was hoping that your fiddle could help.  Unfortunately the link to the fiddle in your post doesn't have a target URL.  Any chance you could repost the link?

Thanks,

Gary

0 Kudos