Select to view content in your preferred language

Import symbology from layer - arcpy

03-21-2017 07:55 AM
New Contributor II


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

Tags (1)
0 Kudos
2 Replies
MVP Emeritus

This is a duplicate of    Looks like geonet hiccup'd.  Please delete one one of the threads.

New Contributor II

i did not realize, thank you! i cannot delete it, though. how to?

0 Kudos