Summary
This tool creates a tracking layer from a feature class or layer containing temporal data.
Usage
For this tool to work, the input feature class or layer must have date and time information contained in a single time field of data type text, short, long, float, double, or date. If the time field data type is date, the tool will automatically detect the format. If the time field data type is anything other than date, a time field format (and possibly other information for a time field data type of text) is required to parse the data values correctly.
If the time field selected is text, short, long, float, or double, the time field format can be selected from a list of supported time field formats, or you can define a custom time field format to interpret custom date and/or time values in a text field. For more information about custom formats for text fields, refer to converting string time values into date format.
If possible, it is recommended to use a time field of data type date with this tool. The Convert Time Field geoprocessing tool can be used to create a date field in your input feature class or layer before using this tool.
If your feature class or layer contains date and time information in two separate text fields, the Concatenate Date and Time Fields tool can be used to combine the information into a single text field before using this tool.
Specifying a track identifier field for the output tracking layer is optional.
This tool allows you to specify a storage policy for the output tracking layer. The default setting is to store the output tracking layer in memory, but choosing the option to store the output tracking layer on disk allows you to create tracking layers from larger data sets. If you choose to store the output layer on disk and your time field is a text or numeric data type, only supported time field formats can be used.
Syntax
arcpy.ta.MakeTrackingLayer(in_features, out_layer, time_zone, adjusted_for_dst, storage_policy, start_time_field, {time_field_format}, {locale_id}, {am_designator}, {pm_designator}, {track_id_field})
Parameter | Explanation | Data Type |
in_features | The input feature class or layer. | Feature Layer |
out_layer | The name of the tracking layer to be created. The newly created tracking layer can be used as input to any geoprocessing tool that accepts a feature layer as input. | Feature Layer |
time_zone | The time zone that the data in the input feature class was recorded in. For a list of available time zones supported by your system, you can open the tool dialog box and expand this drop-down. When you enter the time zone as a parameter, you must use a non-localized string representation of the appropriate Microsoft Time Zone ID, and replace any spaces with underscore characters. For example, the appropriate string representation of the Pacific time zone in the United States is "Pacific_Standard_Time". "NO_TIME_ZONE" can be used to specify no time zone for the output tracking layer. | String |
adjusted_for_dst | If you chose a time zone for your data, this parameter specifies whether the data values in the input time field were recorded with an adjustment for Daylight Saving Time.
| Boolean |
storage_policy | Determines the storage policy for the output tracking layer.
| String |
start_time_field | The field in the input feature class or layer that contains date and time information. This tool requires date and time information to be contained in the same field, and the data type of the field must be Short, Long, Float, Double, Text, or Date. | Field |
time_field_format (Optional) | If the data type of the time field is anything other than Date, this parameter determines the format that will be used to interpret data values in the time field. Some examples of formats are:
If the data type of the time field is Text, either a standard Esri text time format can be used or a custom format can be specified. However, custom formats can not be used if you specified KEEP_ON_DISK for the storage policy. If the data type of the time field is numeric (Short, Long, Float, or Double), only standard Esri numeric time formats can be used. If the data type of the time field is Date, this parameter is not needed. | String |
locale_id (Optional) | If the data type of the time field is Text, this parameter determines which locale will be used to interpret data values in the time field. For all time field data types other than Text, this parameter is not needed. If no locale is entered, the current locale of the operating system will be used. For a list of available locales supported by your system, open the tool dialog box and expand this drop-down. When entering the locale as a parameter, it is recommended to use only the locale ID (LCID) assigned by Microsoft, which can be entered as a long integer such as 1033. You can also enter the full string representation of the locale as a parameter, such as "01033-English_(United_States)", but you must replace spaces with underscore characters. | Long |
am_designator (Optional) | If the time field data type is Text and the time format is a 12-hour clock representation including a time marker ("t" or "tt"), then this parameter determines the character ("t") or characters ("tt") that designate AM in the time field data values. If nothing is entered, then the default AM designator for the selected locale will be used. For all time field data types other than Text, this parameter is not needed. | String |
pm_designator (Optional) | If the time field data type is Text and the time format is a 12-hour clock representation including a time marker ("t" or "tt"), then this parameter determines the character ("t") or characters ("tt") that designate PM in the time field data values. If nothing is entered, then the default PM designator for the selected locale will be used. For all time field data types other than Text, this parameter is not needed. | String |
track_id_field (Optional) | The field that contains data values that will be used to group features into tracks in the output tracking layer. The data type of the field can be Short, Long, Float, Double, Text, or OID. | Field |
Code sample
MakeTrackingLayer example using feature class with time values stored in date field
This sample shows how to run the tool on the feature class whose time field is of field type date. This sample uses the Tracking Analyst tutorial data.
import arcpy
arcpy.CheckOutExtension("tracking")
inputGDB = "C:/arcgis/ArcTutor/Tracking Analyst/Simple/Hurricanes.gdb/atlantic_hurricanes_2000"
timezone = "Eastern_Standard_Time"
arcpy.MakeTrackingLayer_ta( inputGDB, "Hurricanes", timezone, "ADJUSTED_FOR_DST", "COPY_ALL_TO_MEMORY", "Date_Time")
MakeTrackingLayer example using shapefile with time values in a standard text format
This sample shows how to run the tool on a shapefile whose time field is text containing data in a standard Esri format.
import arcpy
arcpy.CheckOutExtension("tracking")
inputShapefile = "C:/vehicles/trains.shp"
timezone = "Central_Standard_Time"
arcpy.MakeTrackingLayer_ta( inputShapefile, "trains_layer", timezone, "ADJUSTED_FOR_DST", "COPY_ALL_TO_MEMORY", "text_date", "yyyy-MM-dd HH:mm:ss")
MakeTrackingLayer example using shapefile with time values stored in a custom text format
This sample shows how to run the tool on a shapefile whose time field is text containing data in a custom format. This example also specifies a Track ID field for the output tracking layer.
import arcpy
arcpy.CheckOutExtension("tracking")
inputShapefile = "C:/vehicles/planes.shp"
timezone = "Central_Standard_Time"
arcpy.MakeTrackingLayer_ta( inputShapefile, "planes_layer", timezone, "ADJUSTED_FOR_DST", "COPY_ALL_TO_MEMORY", "cust_date", "MM/dd/yyyy HH:mm:ss", 1033,"AM", "PM", "EVENTID" )
MakeTrackingLayer example using shapefile with time values in a standard numeric format
This sample shows how to run the tool on a shapefile whose time field is a numeric type containing data in a standard Esri format.
import arcpy
arcpy.CheckOutExtension("tracking")
inputShapefile = "C:/vehicles/trains.shp"
timezone = "Central_Standard_Time"
arcpy.MakeTrackingLayer_ta( inputShapefile, "trains_layer", timezone, "ADJUSTED_FOR_DST", "COPY_ALL_TO_MEMORY", "num_date", "yyyyMMdd")
Environments
Licensing information
- Basic: Requires Tracking Analyst
- Standard: Requires Tracking Analyst
- Advanced: Requires Tracking Analyst