Using the Applying Symbology from Layer tool appears to not capture a layer's table of contents visibility, label properties, feature scale range, or label scale range. I have many feature classes that are repeatedly used in numerous MXDs for which I need to change these properties. I need a process that is similar to said tool because I can run it in a fairly short script and apply it to all my MXDs.

I could use a script similar to that below, but would be required to (in addition to adding lines for the other properties) alter the feature class in ListLayers and the applicable properties many times in order to edit all the feature classes as needed.

mxdList = ['MXD1', 'MXD2', '...']
fcList = ['FC1', 'FC2', '...']

for doc in mxdList:
    mxd = arcpy.mapping.MapDocument('Path\\' + doc)
    for item in fcList:
        for lyr in arcpy.mapping.ListLayers(mxd, item):
            # lyr filename matches FC ToC name less extension
                r'path\lyrFiles\/' + item + '.lyr')
            if lyr.supports('VISIBLE'):
                        lyr.visible = False
            # continue with other properties...

Is there a quick way to change these other properties for many MXDs? This would not be an issue if lyr files captured the properties of table of contents visibility, label properties, feature scale range, or label scale range.


I just found this link, which leads me to think ArcObjects in Python could be a solution to my question. This looks like a can of worms, however, for someone who is fairly new to the use of Python. Are there other alternatives besides extending code above, using ArcObjects, or dragging feature classes from one ArcMap window to another?

  • 1
    Using ArcObjects would definitely get you there via Python, but it is difficult to use if you're not familiar with the Object Library Diagrams, query interfaces, etc. An untested idea that may work is if you make a copy of the layer in the TOC, then change the data source. I'm not sure if that would work or not but may be worth a shot.
    – crmackey
    Commented Dec 12, 2017 at 17:58

2 Answers 2


Seems you've already got .lyr files with the desired properties set that you're loading from. Instead of applying symbology from these, why not add them as layers, replacing previous ones, then swap-out their data sources? I know that this will maintain symbology and label properties, at least, and I hope it also maintains things like visibility toggle and transparency, among others.

import arcpy, os

mxd = arcpy.mapping.MapDocument(mxdPath)
# Below we assume only one dataframe. Cycle through the returned
# list rather than go directly to index zero if that's not the case.
df = arcpy.mapping.ListDataFrames(mxd)[0]

# Loop through existing layers to make replacements for them.
for lyr in arcpy.mapping.ListLayers(mxd):
    # Get name and data source of existing layer.
    lyrName = lyr.name
    aDataSource = lyr.dataSource
    # Below, replace the .lyr filename reference using whatever
    # layer-filename matching makes sense in your data; maybe
    # matching on strings?
    newLyr = arcpy.mapping.Layer(os.path.join(directoryString, "somelayer.lyr"))
    # Swap-in the data source of the pre-existing layer.
    # Note you need to know what kind of workspace you're in for
    # the second parameter, such as a directory with shapefiles,
    # or a File Geodatabase. Below is a non-rigorous check for
    # these two possibilities, but there are several others.
    srcDir, srcName = os.path.split(aDataSource)
    workSpaceType = "SHAPEFILE_WORKSPACE"
    if ".gdb" in srcDir:
        workSpaceType = "FILEGDB_WORKSPACE"
    newLyr.replaceDataSource(srcDir, workSpaceType, srcName)
    # Remove the previous layer, rename the replacement, and replace.
    arcpy.mapping.RemoveLayer(df, lyr)
    newLyr.name = lyrName
    arcpy.mapping.AddLayer(df, newLyr)

You can use a Describe object to get various properties other than their data sources from the pre-existing layers to apply to their replacements, in case you want to carry them over to the new, added layer: http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/describe.htm

More documentation on layer manipulation in general here, including the various kinds of layer data source workspaces and strings for each: http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm

  • Thanks! I hadn't completed the script to perform my task, but what I have tried so far based on your answer appears to be working.
    – reevesii
    Commented Dec 18, 2017 at 15:00

There is an extension to ArcMap called XTools. It has a tool called "Copy Layer Properties". It allows you to copy properties such as the Symbology, Visibility, Transparency, Labels and more between different layers. The link has a video tutorial.

enter image description here

I find it one of the most useful features of XTools, although currently I don't have a copy of it. There is a 14 day trial so you can test it if it works for you.

  • Even if I were to use xtools, I am still in need of a means to copy all of the properties for each given feature class to many MXDs.
    – reevesii
    Commented Dec 12, 2017 at 18:48

Your Answer

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

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