AnsweredAssumed Answered

Does Pro Py have a method to access the time property in a time-enabled layer?

Question asked by tpcolson Champion on Jul 5, 2018
Latest reply on Jul 5, 2018 by bixb0012

From DataFrameTime—Help | ArcGIS Desktop, the following example exports each "Time Frame" as a unique file:


import arcpy
import os

mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Traffic Analysis")[0]
df.time.currentTime = df.time.startTime

while df.time.currentTime <= df.time.endTime:
    # An example str(newTime) would be: "2008-12-29 02:19:59"
    # The following line splits the string at the space and takes the first
    # item in the resulting string. 
    fileName = str(df.time.currentTime).split(" ")[0] + ".png"
    arcpy.mapping.ExportToPNG(mxd, os.path.join(r"C:\Project\Output", fileName), df)
    df.time.currentTime = df.time.currentTime + df.time.timeStepInterval
del mxd

From Migrating from arcpy.mapping to ArcGIS Pro—ArcPy | ArcGIS Desktop  I see 

m = p.listMaps("Yosemite National Park")[0]
for lyr in m.listLayers():
    if lyr.supports("SHOWLABELS"):
       lblClasses = lyr.listLabelClasses()

as an example of how to access the map part, but I'm not seeing any documentation or examples on how to access the time property, if a Pro map has a time-enabled layer. In context, I'm working  Working with a multidimensional raster layer—ArcGIS Pro | ArcGIS Desktop where I have some 100 rasters, each with a time stamp, and I want to export each "Step" as it's own JPEG.