AnsweredAssumed Answered

Import symbology from layer - arcpy

Question asked by marty9 on Mar 21, 2017
Latest reply on Mar 25, 2017 by marty9


I am trying to update the symbology of a raste layer using an existing layer file with 2 different functions:

 - update layer

- apply symbology from layer

The same function works with shapefiles, though.

Nothing happens, still the code runs till the end with no error message, which makes it pretty difficult to find the error.


import arcpy
arcpy.env.overwriteOutput = True
workDir = 'C:/0.STUDY PROJECT/Maps/'

mxd = arcpy.mapping.MapDocument(template)
dfs = arcpy.mapping.ListDataFrames(mxd)
df = dfs[0]

# clip is obtained interpolating a point shapefile with natural neighbours method and clipped with a polygon shapefile
clip = "C:\\0.STUDY PROJECT\\MapsKulmbach\\processed_data\\clip"

depth_data = arcpy.mapping.Layer(clip)
arcpy.mapping.AddLayer(df, depth_data)

srcLay = workDir + "depthSymbology.lyr"
srcLayObj = arcpy.mapping.Layer(srcLay)

# try function 1
arcpy.mapping.UpdateLayer(df, depth_data, srcLayObj, True)

# try function 2
arcpy.ApplySymbologyFromLayer_management (depth_data, srcLayObj)



Do you know what a reason could be?

Thank you