Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Cheers,

In an active Arc Map session - I want to change the symbology of a layer which is repeated multiple times in the mxd. Can I do this?

The basic code I have for getting the layers is below. This is running within ArcMap (not as a .py script)

myMXD = arcpy.mapping.MapDocument("Current")
lstDataFrames=arcpy.mapping.ListDataFrames(myMXD)
lstLayers=arcpy.mapping.ListLayers(myMXD)

hazardLayer=arcpy.mapping.ListLayers(myMXD,'*Haz*')

allFrames=arcpy.mapping.ListDataFrames(myMXD)

for dataFrame in allFrames:
    myMXD.activeView=dataFrame
    for mapLayer in hazardLayer:
        mapLayer.visible=False

This just changes the visibility to off...can I change the color for example to some RGB value?

Thanks,

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

First create a default layer file to use as a template then:

myMXD = arcpy.mapping.MapDocument("Current")
lstDataFrames=arcpy.mapping.ListDataFrames(myMXD)
lstLayers=arcpy.mapping.ListLayers(myMXD)

hazardLayer=arcpy.mapping.ListLayers(myMXD,'*Haz*')

allFrames=arcpy.mapping.ListDataFrames(myMXD)

for dataFrame in allFrames:
     myMXD.activeView=dataFrame
     for mapLayer in hazardLayer:
         arcpy.ApplySymbologyFromLayer_management(mapLayer, r"C:\TemplateLayers\HazardTemplate.lyr")
share|improve this answer
    
Thanks...that's great. Is this also possible with the symbology of .shp files and not only .lyr files? –  GeorgeC May 17 '11 at 6:04
add comment

You could use the Apply Symbology From Layer method.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.