Select to view content in your preferred language

Import symbology from layer - arcpy

778
2
03-21-2017 07:55 AM
martinaraffellini
Deactivated User

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
Deactivated User

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

0 Kudos