Import symbology from layer - arcpy

626
2
03-21-2017 07:55 AM
martinaraffellini
New Contributor II

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

Tags (1)
0 Kudos
2 Replies
RebeccaStrauch__GISP
MVP Emeritus

This is a duplicate of https://community.esri.com/thread/192108-import-symbology-from-layer-arcpy    Looks like geonet hiccup'd.  Please delete one one of the threads.

martinaraffellini
New Contributor II

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

0 Kudos