Select to view content in your preferred language

Can you set different opacities for features in the same layer?

2770
7
01-31-2011 05:11 AM
KenDoman
Frequent Contributor
I am trying to set transparencies for different features within a layer.  Some polygon features are drawn with a thick border and no fill, therefore they don't need to be transparent.  However, some polygon features are solid and need to be transparent to be properly viewed on the map.  I'm using ArcGIS 10 and Javascript API v2.1

Here's what I've tried so far, and the results:

Set transparencies in the .mxd file => "transparent" polygons completely opaque. .mxd layer transparency does not translate.
Set {opacity:0.7} when setting up layer to add to map => makes all layers transparent, washing out polygon borders on some features that need opacity:1.0 to view.
Breaking up layers so that some can be set {opacity:0.7} and others {opacity:1.0} => messes up flow of table of contents, and requires major reworking of identify, query, and other tools.

So far, I haven't found anything in the API that lets me change individual feature opacity.  Any suggestions?
0 Kudos
7 Replies
HemingZhu
Frequent Contributor
I am trying to set transparencies for different features within a layer.  Some polygon features are drawn with a thick border and no fill, therefore they don't need to be transparent.  However, some polygon features are solid and need to be transparent to be properly viewed on the map.  I'm using ArcGIS 10 and Javascript API v2.1

Here's what I've tried so far, and the results:

Set transparencies in the .mxd file => "transparent" polygons completely opaque. .mxd layer transparency does not translate.
Set {opacity:0.7} when setting up layer to add to map => makes all layers transparent, washing out polygon borders on some features that need opacity:1.0 to view.
Breaking up layers so that some can be set {opacity:0.7} and others {opacity:1.0} => messes up flow of table of contents, and requires major reworking of identify, query, and other tools.

So far, I haven't found anything in the API that lets me change individual feature opacity.  Any suggestions?


Have you considered display the layer as a feature layer and use ClassBreaksRenderer to render those polgons differently?
0 Kudos
KenDoman
Frequent Contributor
Have you considered display the layer as a feature layer and use ClassBreaksRenderer to render those polygons differently?


Finally tried this. Unfortunately, the map I'm using has 40+ layers, and displaying half of them as feature layers slows the map performance to a crawl. It's sad, because I only need the transparency for 5 of the 40 layers, but I can't render most of the map as a dynamicMapServiceLayer and those five as feature layers and break the overlap arrangement.

I've also optimized the maps as .msd's.  It's great for showing transparency between layers on the same mapServiceLayer, but between service layers, there's no transparency.
0 Kudos
LawrenceDhliwayo
Deactivated User
Any one with any updates on this thread please, ESRI?

Thanks,
Lawrence
0 Kudos
JeffPace
MVP Alum
Does your transparency need to be adjustable? Can't you just set the transparency in the mxd for the FCs that need it?
0 Kudos
DallasShearer
Deactivated User
If you can create a .emf image with the opacity level you need and then symbolize your features to fill with the picture symbol and then choose the .emf file, that may work for you.
0 Kudos
LawrenceDhliwayo
Deactivated User
Does your transparency need to be adjustable? Can't you just set the transparency in the mxd for the FCs that need it?


Thanks - but ideally I would like to adjust transparency for each feature class within the mxd individually and if you do this, the transparency is not respected in JSAPI. Setting transparency for the dynamic service layer though works but is a little restricting.
0 Kudos
LawrenceDhliwayo
Deactivated User
If you can create a .emf image with the opacity level you need and then symbolize your features to fill with the picture symbol and then choose the .emf file, that may work for you.


Thanks - but it sounds a little bit of an effort, I have 19 dynamic service layers each with up to 20 layers each! It might take me some time.....
0 Kudos