<?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 Pro ArcPy - Creating Time Slider from Layer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/pro-arcpy-creating-time-slider-from-layer/m-p/1113820#M62888</link>
    <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying to connect temporal data from a particular data table from ArcPy to my XY data and am having a bit of trouble. &lt;A href="https://community.esri.com/t5/python-questions/pro-arcpy-setting-time-property-on-layer-or/td-p/208049" target="_self"&gt;This forum post&lt;/A&gt; got me a good starting point, but I'm a bit stumped from here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am essentially trying to replicate the functionality when you do the following actions:&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Click the relevant data table&lt;/LI&gt;&lt;LI&gt;Go to Settings&lt;/LI&gt;&lt;LI&gt;Click Time&lt;/LI&gt;&lt;LI&gt;Assuming you have a column "timestamp":&lt;OL&gt;&lt;LI&gt;Set the data column as such&lt;/LI&gt;&lt;LI&gt;Set unique value for each time point&lt;/LI&gt;&lt;LI&gt;Set the time format (i.e. "yyyyMMdd")&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This generates a time slider on top of the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I manually investigated the data fields using the Python window and tried to reconstruct the code necessary to reproduce it from scratch. I came up with the following code, where "example1" is a data table that has the fields "latitude", "longitude", and "timestamp." The "timestamp" field is in format "yyyyMMdd."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

p = arcpy.mp.ArcGISProject("CURRENT)
m = p.listMaps("Map)[0]
l = m.listLayers("example")[0]

l_cim = l.getDefinition("V2")
ft = l_cim.featureTable

ft.timeFields = arcpy.cim.CIMVectorLayers.CIMTimeTableDefinition(
    startTimeField="timestamp",
    timeValueFormat="yyyyMMdd"
)

timeReference = arcpy.cim.CIMExternal.TimeReference()
customTimeExtent = arcpy.cim.CIMExternal.TimeExtent()
ft.timeDefinition = arcpy.cim.CIMVectorLayers.CIMTimeDataDefinition(
    useTime=True,
    timeReference=timeReference,
    timeExtentCanChange=False,
    hasLiveData=False,
    customTimeExtent=customTimeExtent
)

ft.timeDisplayDefinition = arcpy.cim.CIMVectorLayers.CIMTimeDisplayDefinition(
    cumulative=False,
    timeInterval=10,
    timeIntervalUnits='esriTimeUnitsUnknown',
    timeOffset=0.0,
    timeOffsetUnits='esriTimeUnitsDays',
    uniqueTimes=[]
)

ft.timeDimensionFields = arcpy.cim.CIMVectorLayers.CIMTimeDimensionDefinition()

l_cim.featureTable = ft
l.setDefinition(l_cim)

l.enable_time()

p.save()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From what I can tell, this creates a CIM that matches the corresponding CIM that was created when I made a Time Slider in the UI. I checked this through the interactive Python window in ArcGIS Pro. When I do this through the Python script, a Time Slider is created, but it does not connect with the data. When I disable time in the UI, the points appear, but when I enable time, everything disappears.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone direct me to any documentation for this? I'm a bit stuck right now. Thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Nov 2021 21:56:49 GMT</pubDate>
    <dc:creator>AntonioSiracusa</dc:creator>
    <dc:date>2021-11-03T21:56:49Z</dc:date>
    <item>
      <title>Pro ArcPy - Creating Time Slider from Layer</title>
      <link>https://community.esri.com/t5/python-questions/pro-arcpy-creating-time-slider-from-layer/m-p/1113820#M62888</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying to connect temporal data from a particular data table from ArcPy to my XY data and am having a bit of trouble. &lt;A href="https://community.esri.com/t5/python-questions/pro-arcpy-setting-time-property-on-layer-or/td-p/208049" target="_self"&gt;This forum post&lt;/A&gt; got me a good starting point, but I'm a bit stumped from here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am essentially trying to replicate the functionality when you do the following actions:&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Click the relevant data table&lt;/LI&gt;&lt;LI&gt;Go to Settings&lt;/LI&gt;&lt;LI&gt;Click Time&lt;/LI&gt;&lt;LI&gt;Assuming you have a column "timestamp":&lt;OL&gt;&lt;LI&gt;Set the data column as such&lt;/LI&gt;&lt;LI&gt;Set unique value for each time point&lt;/LI&gt;&lt;LI&gt;Set the time format (i.e. "yyyyMMdd")&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This generates a time slider on top of the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I manually investigated the data fields using the Python window and tried to reconstruct the code necessary to reproduce it from scratch. I came up with the following code, where "example1" is a data table that has the fields "latitude", "longitude", and "timestamp." The "timestamp" field is in format "yyyyMMdd."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

p = arcpy.mp.ArcGISProject("CURRENT)
m = p.listMaps("Map)[0]
l = m.listLayers("example")[0]

l_cim = l.getDefinition("V2")
ft = l_cim.featureTable

ft.timeFields = arcpy.cim.CIMVectorLayers.CIMTimeTableDefinition(
    startTimeField="timestamp",
    timeValueFormat="yyyyMMdd"
)

timeReference = arcpy.cim.CIMExternal.TimeReference()
customTimeExtent = arcpy.cim.CIMExternal.TimeExtent()
ft.timeDefinition = arcpy.cim.CIMVectorLayers.CIMTimeDataDefinition(
    useTime=True,
    timeReference=timeReference,
    timeExtentCanChange=False,
    hasLiveData=False,
    customTimeExtent=customTimeExtent
)

ft.timeDisplayDefinition = arcpy.cim.CIMVectorLayers.CIMTimeDisplayDefinition(
    cumulative=False,
    timeInterval=10,
    timeIntervalUnits='esriTimeUnitsUnknown',
    timeOffset=0.0,
    timeOffsetUnits='esriTimeUnitsDays',
    uniqueTimes=[]
)

ft.timeDimensionFields = arcpy.cim.CIMVectorLayers.CIMTimeDimensionDefinition()

l_cim.featureTable = ft
l.setDefinition(l_cim)

l.enable_time()

p.save()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From what I can tell, this creates a CIM that matches the corresponding CIM that was created when I made a Time Slider in the UI. I checked this through the interactive Python window in ArcGIS Pro. When I do this through the Python script, a Time Slider is created, but it does not connect with the data. When I disable time in the UI, the points appear, but when I enable time, everything disappears.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone direct me to any documentation for this? I'm a bit stuck right now. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 21:56:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-arcpy-creating-time-slider-from-layer/m-p/1113820#M62888</guid>
      <dc:creator>AntonioSiracusa</dc:creator>
      <dc:date>2021-11-03T21:56:49Z</dc:date>
    </item>
  </channel>
</rss>

