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.
arcpy.env.overwriteOutput = True
workDir = 'C:/0.STUDY PROJECT/Maps/'
mxd = arcpy.mapping.MapDocument(template)
dfs = arcpy.mapping.ListDataFrames(mxd)
df = dfs
# 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)
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?