<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ApplySymbologyFromLayer_management Not Updating Layer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270675#M20900</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy.mapping&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import datetime&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.overwriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; It seems the "ApplySymbologyFromLayer_management" process doesn't come across.&amp;nbsp; I've looked at my lyr file in ArcCatalog and the color ramp is there.&amp;nbsp; Any ideas?&amp;nbsp; The lyr file is also "Time-enabled", if that makes any difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon Mulder&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;California Depertment of Water Resources&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; ##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()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Jan 2014 19:40:01 GMT</pubDate>
    <dc:creator>JonathanMulder</dc:creator>
    <dc:date>2014-01-02T19:40:01Z</dc:date>
    <item>
      <title>ApplySymbologyFromLayer_management Not Updating Layer</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270675#M20900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy.mapping&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import datetime&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.overwriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; It seems the "ApplySymbologyFromLayer_management" process doesn't come across.&amp;nbsp; I've looked at my lyr file in ArcCatalog and the color ramp is there.&amp;nbsp; Any ideas?&amp;nbsp; The lyr file is also "Time-enabled", if that makes any difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon Mulder&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;California Depertment of Water Resources&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; ##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()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2014 19:40:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270675#M20900</guid>
      <dc:creator>JonathanMulder</dc:creator>
      <dc:date>2014-01-02T19:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management Not Updating Layer</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270676#M20901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I beleive you are missing arcpy.mapping.ListLayers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000008000000" rel="nofollow" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000008000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of using arcpy.ApplySymbologyFromLayer_management i use &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.mapping.UpdateLayer, so you might what to try that.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2014 20:49:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270676#M20901</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2014-01-02T20:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management Not Updating Layer</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270677#M20902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah!&amp;nbsp; That did the trick.&amp;nbsp; I never have understood what the "arcpy.mapping.ListLayers" function was for, although I have seen it a lot in the examples.&amp;nbsp; I always thought it was to iterate through several layers.&amp;nbsp; But, if I understand correctly from the link you sent me, I have to make a Python list (consisting of one variable -- i.e. one layer) and then apply the symbology.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks very much!&amp;nbsp; I'm on the road again!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import arcpy.mapping
import datetime
import os
arcpy.env.overwriteOutput = True


##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")
for lyr in arcpy.mapping.ListLayers(mxd, "WSE_Contours", df):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ApplySymbologyFromLayer_management(lyr, InSymbologyLayer)
arcpy.RefreshTOC()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:14:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270677#M20902</guid>
      <dc:creator>JonathanMulder</dc:creator>
      <dc:date>2021-12-11T13:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management Not Updating Layer</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270678#M20903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should have to loop since it's not repeating. For better practice i would place the arcpy.mapping.ListLayers like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd, "WSE_Contours", df)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:14:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270678#M20903</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2021-12-11T13:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management Not Updating Layer</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270679#M20904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not bad Tony - just remember, all the listing functions return a list.&amp;nbsp; That means if you're expecting a single item returned, you need to 'get it' from the list with [0].&amp;nbsp;&amp;nbsp; Just as you did listing data frames...[0] means you're getting the 1st item in the list (which with a single item returned, then return that item).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/489960"&gt;@Jon&lt;/a&gt;, just curious, is there any reason you cannot do something like the following (I didn't test), applying the symbology before adding it to the map?:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
addLayer = arcpy.mapping.Layer(TempLayer)
arcpy.ApplySymbologyFromLayer_management(addLayer, InSymbologyLayer)
arcpy.mapping.AddLayer(df, addLayer, "AUTO_ARRANGE")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:14:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270679#M20904</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-11T13:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management Not Updating Layer</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270680#M20905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wayne and Tony,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks very much for your inputs!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ultimately, I went back to the process of adding a layer file, then replacing the DataSource for the layer with another one in a geodatabase that the user selects.&amp;nbsp; The "ApplySymbologyFromLayer" only applies the Symbology properties from the layer.&amp;nbsp; My saved template layers also have Label and Time properties.&amp;nbsp; So, adding a Layer file then replacing the datasource made the best sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne, I also wanted to let you know that I've solved the issue with "Time-Enabled Layers.&amp;nbsp; The template layers have to be time-enabled before adding to map.&amp;nbsp; After that, it's somewhat simple to modify dataframe time properties.&amp;nbsp; I have another script that actually generates the daily contours and places them (and the surface rasters) into a newly created geodatabase.&amp;nbsp; The geodatabase naming convention follows the format of "Contours_" + TimeInterval + DateStart + DateEnd (i.e., "Contours_Daily_20130625_20130731" or "Contours_Monthly_20110101_20131231").&amp;nbsp; By splitting out the GeoDatabase name, I am able to assign the time.timeWindowUnits, time.startTime, and time.endTime.&amp;nbsp; It's pretty slick; get back to me if you want more information.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another issue that I had was graduated color-ramping the contours from red (lowest) to green (highest).&amp;nbsp; The issue is that the template layer symbology is for another set of contours that are not always the sample elevation range.&amp;nbsp; So some analysis of the Contours Featureclass "Contour" field was needed.&amp;nbsp; This was done by using a little Python code snippet ("SortedContours = unique_values(Contours_lyr, "Contour") that provided a sorted python list of unique contour values.&amp;nbsp; From the list, I derived the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LowestContour = SortedContours[0]&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HighestContour = SortedContours[-1]&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContourInterval = SortedContours[1] - SortedContours[0]&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalContours = len(SortedContours)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;An additional contour was inserted into theSortedContours below the lowest contour value.&amp;nbsp; This is because you need one more classBreakValue then your actual contour values.&amp;nbsp; Then, I spun out a string list of the SortedContour list (and deleted the first value) to use as the classBreakLabels.&amp;nbsp; Reading the GraduatedColorsSymbology help was invaluable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On a final note, if you glance at my code, you'll notice that I actually have two Contours Featureclasses.&amp;nbsp; This is because groundwater contours can be portrayed in two different ways: Water Surface Elevation (WSE) or Depth To Water (DTW).&amp;nbsp; The DTW contours are very useful for identifying how deep a well needs to be to reach groundwater.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next step is to run a few time-step simulations and spin them out to movie files.&amp;nbsp; Let me know if you'd like to take a look at them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for all your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon Mulder&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Engineering Geologist&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;California Department of Water Resources&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import arcpy.mapping
import datetime
import os

def AddContours(DataType,LayerFileNameAndLocation):
&amp;nbsp;&amp;nbsp;&amp;nbsp; Contours_lyr = arcpy.mapping.Layer(LayerFileNameAndLocation)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Contours_lyr.replaceDataSource(GeoDatabaseNameAndLocation,"NONE",DataType + "_AllContours3D")
&amp;nbsp;&amp;nbsp;&amp;nbsp; if Contours_lyr.supports("LABELCLASSES"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("LABELCLASSES are supported.")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Contours_lyr.labelClasses[0].expression =&amp;nbsp; "[Contour]"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Contours_lyr.showLabels = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; if Contours_lyr.symbologyType == "GRADUATED_COLORS":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("GRADUATED_COLORS are supported.")
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Create a List of unique Contour values.&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; SortedContours = unique_values(Contours_lyr, "Contour")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(SortedContours)
&amp;nbsp;&amp;nbsp;&amp;nbsp; LowestContour = SortedContours[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; HighestContour = SortedContours[-1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; ContourInterval = SortedContours[1] - SortedContours[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalContours = len(SortedContours)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Lowest contour: " + str(LowestContour))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Highest contour: " + str(HighestContour))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Contour Interval: " + str(ContourInterval))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Number of Contours: " + str(TotalContours))
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Insert an&amp;nbsp; additional contour before Lowest Contour.
&amp;nbsp;&amp;nbsp;&amp;nbsp; SortedContours.insert(0,LowestContour - ContourInterval)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##arcpy.AddMessage(SortedContours)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Increment Total Contours by 1.
&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalContours = TotalContours + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Assign classBreakValues to SortedContours.
&amp;nbsp;&amp;nbsp;&amp;nbsp; Contours_lyr.symbology.classBreakValues = SortedContours
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Reclassify Color Ramp.
&amp;nbsp;&amp;nbsp;&amp;nbsp; Contours_lyr.symbology.reclassify()
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Create a string List of Sorted Contours for layer labels.
&amp;nbsp;&amp;nbsp;&amp;nbsp; LabelList = [str(int(i)) for i in SortedContours]
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##arcpy.AddMessage(LabelList)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Delete first variable in LabelList.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##NOTE: This is important because the classBreakLabels MUST be one less than the classBreakValues.
&amp;nbsp;&amp;nbsp;&amp;nbsp; del LabelList[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##arcpy.AddMessage(LabelList)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Contours_lyr.symbology.classBreakLabels = LabelList
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.AddLayer(df,Contours_lyr,"BOTTOM")&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return;

def unique_values(table, field):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(table, [field]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return sorted({row[0] for row in cursor}) 


GeoDatabaseNameAndLocation = arcpy.GetParameterAsText(0)
LayerFileNameAndLocation_Wells = arcpy.GetParameterAsText(1)
LayerFileNameAndLocation_WSE_Contours = arcpy.GetParameterAsText(2)
LayerFileNameAndLocation_DTW_Contours = arcpy.GetParameterAsText(3)

arcpy.env.overwriteOutput = True
##GeoDatabaseNameAndLocation = "G:\Documents\GIS\HydstraData\HydstraMeasurementsDeep\Contours_Daily_20130625_20130731.gdb"
##LayerFileNameAndLocation_Wells = "G:\Documents\GIS\HydstraData\Template_WellPoints.lyr"
##LayerFileNameAndLocation_WSE_Contours = "G:\Documents\GIS\HydstraData\Template_WSE_Contours.lyr"
##LayerFileNameAndLocation_DTW_Contours = "G:\Documents\GIS\HydstraData\Template_DTW_Contours.lyr"

GeoDatabaseName = os.path.basename(GeoDatabaseNameAndLocation)
GeoDatabaseLocation = os.path.dirname(GeoDatabaseNameAndLocation)
##Split GeoDatabaseName and get variables for later use.
GeoDatabaseSplitParts = GeoDatabaseName.split("_")
TimeInterval = GeoDatabaseSplitParts[1]
arcpy.AddMessage(TimeInterval)
StartTime = GeoDatabaseSplitParts[2]
arcpy.AddMessage(StartTime)
EndTime = GeoDatabaseSplitParts[3][:8]
arcpy.AddMessage(EndTime)

##Determine the TimeWindowUnits.
if TimeInterval == "Daily":
&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeWindowUnits = "DAYS"
elif TimeInterval == "Weekly":
&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeWindowUnits = "WEEKS"
elif TimeInterval == "Monthly":
&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeWindowUnits = "MONTHS"
elif TimeInterval == "Annually":
&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeWindowUnits = "YEARS"
arcpy.AddMessage(TimeWindowUnits)

##Reference the Current map document.
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]

arcpy.env.workspace = GeoDatabaseLocation

##Add WellPoints Featureclass to map.
arcpy.AddMessage("Adding WellPoints Featureclass to map.")
##WellPtsLyrFile = os.path.join(LayerFileLocation,"Template_WellPoints.lyr")
Wells_lyr = arcpy.mapping.Layer(LayerFileNameAndLocation_Wells)
##Replace the Layer DataSource.
Wells_lyr.replaceDataSource(GeoDatabaseNameAndLocation,"NONE","WellPoints")
##Show labels for WellPoints.
if Wells_lyr.supports("LABELCLASSES"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; Wells_lyr.labelClasses[0].expression =&amp;nbsp; "[StateWellNumber]"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Wells_lyr.showLabels = True
arcpy.mapping.AddLayer(df, Wells_lyr, "TOP")

ContoursToAdd = AddContours("WSE",LayerFileNameAndLocation_WSE_Contours)
ContoursToAdd = AddContours("DTW",LayerFileNameAndLocation_DTW_Contours)

if Wells_lyr.supports("TIME"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("TIME is supported.")
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyrTime = Wells_lyr.time
&amp;nbsp;&amp;nbsp;&amp;nbsp; if Wells_lyr.time.isTimeEnabled:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("TIME is enabled.")
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("TIME is NOT enabled.")
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("TIME is NOT supported.")

StartTime = datetime.datetime.strptime(StartTime,"%Y%m%d")
EndTime = datetime.datetime.strptime(EndTime,"%Y%m%d")

df.time.resetTimeExtent()
df.time.currentTime = StartTime
df.time.startTime = StartTime
df.time.endTime = EndTime
df.time.timeWindowUnits = TimeWindowUnits
df.time.timeWindow = 0

##Turn off the "DTW_Contours" layer.
arcpy.mapping.Layer("DTW_Contours").visible = False
arcpy.RefreshTOC()
arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:14:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270680#M20905</guid>
      <dc:creator>JonathanMulder</dc:creator>
      <dc:date>2021-12-11T13:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management Not Updating Layer</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270681#M20906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wow, good work!...if your script is performing well for you, that's great.&amp;nbsp; If you have any further questions or performance issues, I'd like to help.&amp;nbsp; Yes, I'd like to see the movie files when finished - you have my email, and if the files are too large to send, just let me know where you post them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 19:43:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270681#M20906</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2014-01-03T19:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management Not Updating Layer</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270682#M20907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Jon -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found your post via a google search and was wondering if you had any advice (I know this thread was from a while ago).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am creating a model for time-enabled layers to display flu data over a period of a year.&amp;nbsp; I am not sure how this compares to your project but I am having the same issue you had where I needed to enable the time on the layer.&amp;nbsp; I thought I was going to be able to do this when I did the symbology but -just like you added-there is no place to enable time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will try your code out and see if it will work.&amp;nbsp; But were you able to call the time slider automatically suing your code? Or did you use animation? I saw that you asid something about creating a movie file so I was curious which route you took.&amp;nbsp; And did you do that through code or manually?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I apologize for all of the questions, especially so far after you posted this.&amp;nbsp; Any tips or tricks would be great, would love to see the final result of what you did, or anything similar (if you even still have it)!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Caroline&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2014 14:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-not-updating/m-p/270682#M20907</guid>
      <dc:creator>CarolineMerz</dc:creator>
      <dc:date>2014-04-28T14:56:30Z</dc:date>
    </item>
  </channel>
</rss>

