Hi,
I am adding a time enabled layer to a non time aware dataframe :
import arcpy
import datetime
import os
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "New Data Frame")[0]
timeLayer = arcpy.mapping.Layer(r"C:\Project\Data\Accidents.lyr")
arcpy.mapping.AddLayer(df, timeLayer, "AUTO_ARRANGE")
df.time.resetTimeExtent()
df.time.timeWindowUnits = "DAYS"
df.time.timeWindow = 7
df.time.currentTime = datetime.datetime(2008, 10, 1)
endTime = datetime.datetime(2008, 10, 31)
interval = arcpy.time.EsriTimeDelta(1, 'weeks')
mxd.save()
"""
while df.time.currentTime <= endTime:
fileName = str(df.time.currentTime).split(" ")[0] + ".png"
arcpy.mapping.ExportToPNG(mxd, os.path.join(r"C:\Project\Output", fileName))
df.time.currentTime = df.time.currentTime + interval
del mxd, timeLayer
"""
However when I add the layer to the mxd and open the map document the time slider window says time is disabled on this map even tho the layer just added is time-enabled. I don't understand why this is?
I am adding a time enabled layer to a non time aware dataframe :
import arcpy
import datetime
import os
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "New Data Frame")[0]
timeLayer = arcpy.mapping.Layer(r"C:\Project\Data\Accidents.lyr")
arcpy.mapping.AddLayer(df, timeLayer, "AUTO_ARRANGE")
df.time.resetTimeExtent()
df.time.timeWindowUnits = "DAYS"
df.time.timeWindow = 7
df.time.currentTime = datetime.datetime(2008, 10, 1)
endTime = datetime.datetime(2008, 10, 31)
interval = arcpy.time.EsriTimeDelta(1, 'weeks')
mxd.save()
"""
while df.time.currentTime <= endTime:
fileName = str(df.time.currentTime).split(" ")[0] + ".png"
arcpy.mapping.ExportToPNG(mxd, os.path.join(r"C:\Project\Output", fileName))
df.time.currentTime = df.time.currentTime + interval
del mxd, timeLayer
"""
However when I add the layer to the mxd and open the map document the time slider window says time is disabled on this map even tho the layer just added is time-enabled. I don't understand why this is?