AnsweredAssumed Answered

Import symbology from layer - arcpy

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

Hello!

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.

 

data = arcpy.mapping.Layer(raster)             # raster path defined above

arcpy.mapping.AddLayer(df, depth_data)    # data frame defined above

srcLay = workDir + "Symbology.lyr"    # working directory defined above

srcLayObj = arcpy.mapping.Layer(srcLay)


# this function:

arcpy.mapping.UpdateLayer(df, data, srcLayObj, True)


#  or alternatively:

# arcpy.ApplySymbologyFromLayer_management (data, srcLayObj)

 

Do you know what a reason could be?

Thank you

Outcomes