2

I would like to create an ArcPy script to change the color and transparency of a collection of layers.

The color and transparency would be based on wildcards such as "_dog" or "_chicken".

The layer symbology is "single symbol" and the transparency will be a constant percentage for the color.

The problem I encountered, how do I change the color and transparency of the layer?

I can't find any code samples or documentation to point me in the right direction.

I found a post that suggests this is not possible with ArcPy ... hopefully that's incorrect.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked May 18, 2015 at 16:31
1

2 Answers 2

5

You can't really change the symbology of a layer in arcpy with the level of customization you have when just right clicking a layer and using the symbology menu. However, you can make a "template" layer that contains the symbology you want and then use ApplySymbologyFromLayer_management (in_layer, in_symbology_layer). This will allow you to apply the symbology for any layer with that of the "template". Then you can use:

yourLayer = arcpy.mapping.Layer(r'path to your layer') 
yourLayer.transparency = 50 #as a percentage
answered May 18, 2015 at 18:09
4

It is not possible to change the properties of a layer directly. The properties of a layer can be changed, but only by importing properties from another layer in the map or a layer file. Even the layer name cannot be changed without an existing layer or layer file. "UpdateLayer" in the ArcGIS Help can give you more details and some examples.

answered May 18, 2015 at 16:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.