I am trying to apply a graduated color symbology from one layer to another. The script adds a layer to an mxd but foes not apply the symbology from the symbology layer.
Can someone tell me what I am doing wrong?
This did work a few days ago for other layers but is no longer working.
This is the script, path names modifiied
import arcpy
arcpy.env.workspace = r"C:\Workarea\BrandiS"
mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"
addLayer = arcpy.mapping.Layer(featureLayer) arcpy.mapping.AddLayer(df, addLayer, "TOP")
if addLayer.symbologyType == "GRADUATED_COLOR":
addLayer.symbology.valueField = "Join_Count"
symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"
arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)
mxd.save()
del mxd, df, featureLayer, addLayer, symbolLayer
import arcpy
arcpy.env.workspace = r"C:\Workarea\BrandiS"
mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"
addLayer = arcpy.mapping.Layer(featureLayer)
arcpy.mapping.AddLayer(df, addLayer, "TOP")
if addLayer.symbologyType == "GRADUATED_COLOR":
addLayer.symbology.valueField = "Join_Count"
symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"
arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)
mxd.save()
del mxd, df, featureLayer, addLayer, symbolLayer