Created
May 29, 2015 12:02
-
-
Save cindygis/af9911aa0ab2433117f7 to your computer and use it in GitHub Desktop.
Updates a layer name with the name of the group layer it is in.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# @date 29/05/2015 | |
# @author Cindy Williams | |
# | |
# Updates a layer name with the name of the group layer | |
# it is in, in an existing mxd. | |
# | |
# For use in the Python window in ArcMap. | |
# | |
import arcpy | |
mxd = arcpy.mapping.MapDocument("CURRENT") | |
lyrs = [lyr for lyr in arcpy.mapping.ListLayers(mxd) if lyr.isFeatureLayer] | |
for lyr in lyrs: | |
lyr.name = lyr.name + "_" + lyr.longName.split("\\")[0] | |
arcpy.RefreshTOC() | |
mxd.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment