UpdateLayerTime() works on 10.2.2?

3610
0
12-11-2014 02:53 AM
JoseEduardo_Moyano_Capilla
New Contributor

Hi all,

 

I am pretty new with Python and I am trying to do something quite simple but it doesn't work. I am trying to add automatically a layer in a mxd document and I want that this layer takes the symbology and the time properties from another layer file. I get the symbology using UpdateLayer() function, and it works, but I try to get the time properties using UpdateLayerTime() function but it doesn't work. The script runs well and I don't get any error message but when I open the layer in ArcMap the time properties are not enabled.

 

I don't get where the error is, so I am wondering if it's maybe that this function doesn't work at all. I am using 10.2.2. Please find below an extract of the code.

 

mxd = arcpy.mapping.MapDocument(template)

df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

 

# Modify the properties of the layer with the layer file template

AddLayer = arcpy.mapping.Layer(LyrFile)

sourceLayer = arcpy.mapping.Layer(r'C:\Arcdata\Dis_template.lyr')

arcpy.mapping.UpdateLayerTime(df,AddLayer,sourceLayer)

arcpy.mapping.UpdateLayer(df,AddLayer,sourceLayer,True)

 

 

I would appreciate any light on this.

 

Thanks in advance!

 

Jose

0 Kudos
0 Replies