import arcpy, datetime mxd = arcpy.mapping.MapDocument(r"C:\GIS_data\mxds\ytf.mxd") df = arcpy.mapping.ListDataFrames(mxd)[0] df.time.currentTime = datetime.datetime(1961,01,01) endTime = datetime.datetime(2010,01,01) interval = datetime.timedelta(days=1826.25) #added "+ df.time.timeStepInterval" to the end of the while statement because #the final year group 2010 was getting cut off while df.time.currentTime <= df.time.endTime + interval: #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 = "ytf_fall_" + str(df.time.currentTime).split("-")[0] + ".png" arcpy.mapping.ExportToPNG(mxd, r"C:\GIS_data\media\ytf\\" + fileName) df.time.currentTime = df.time.currentTime + interval print fileName del mxd
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.