import arcpy
import arcpy.mapping
import datetime
import os
arcpy.env.overwriteOutput = True
I've been struggling with this for a few hours in a rather large script, so I trimmed it down to just a few lines of code. It seems the "ApplySymbologyFromLayer_management" process doesn't come across. I've looked at my lyr file in ArcCatalog and the color ramp is there. Any ideas? The lyr file is also "Time-enabled", if that makes any difference.
Jon Mulder
California Depertment of Water Resources
import arcpy.mapping
import datetime
import os
arcpy.env.overwriteOutput = True
I've been struggling with this for a few hours in a rather large script, so I trimmed it down to just a few lines of code. It seems the "ApplySymbologyFromLayer_management" process doesn't come across. I've looked at my lyr file in ArcCatalog and the color ramp is there. Any ideas? The lyr file is also "Time-enabled", if that makes any difference.
Jon Mulder
California Depertment of Water Resources
Code:
##Add GSE_AllContours3D Featureclass to map.
mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
FeatureClassToAdd = "G:\Documents\GIS\HydstraData\HydstraMeasurementsDeep\Contours_Daily_20130625_20130731.gdb\WSE_AllContours3D"
InSymbologyLayer = "G:\Documents\GIS\HydstraData\Template_Contours.lyr"
TempLayer = "WSE_Contours"
# Make a layer from the feature class
arcpy.MakeFeatureLayer_management(FeatureClassToAdd,TempLayer)
addLayer = arcpy.mapping.Layer(TempLayer)
arcpy.mapping.AddLayer(df, addLayer, "AUTO_ARRANGE")
arcpy.ApplySymbologyFromLayer_management(addLayer, InSymbologyLayer)
arcpy.RefreshTOC()