Available with Network Analyst license.
This help topic provides conceptual information on how live traffic works. For an overview of traffic, read What is traffic data. For step-by-step instructions on how to configure live traffic, see Configuring traffic in a network dataset and tutorial exercise 10. For instructions on how to solve a network analysis using live traffic data, see Network analysis using traffic data and tutorial exercise 11.
How live traffic works
The network dataset reads live traffic speeds from dynamic traffic format (DTF) files and relates the speeds to edges using traffic message channel (TMC) codes. (TMC codes are standard unique identifiers that are supported by various organizations, including traffic data providers.) The following graphic and the text below illustrate and describe this process.
The network dataset queries an edge for the current travel time. This happens when a network analysis layer is being solved or when traffic is being drawn on a map.
The identifying source feature information (source feature class, source feature, and from-to and to-from position) is used to look up one or more TMC values. The lookup is performed with the information that was in the Streets-TMC Join Table at the time of the last network build. (The Streets-TMC Join Table simply relates streets to TMCs. It is described further in the next section.)
The network dataset looks for a DTF file, which is a binary file designed for network datasets, and reads the travel speed information. The files are stored in a directory that you point the network dataset to using a local or UNC path. (You type the path in the traffic page of the New Network Dataset wizard or the Network Dataset Properties dialog box.)
Each DTF file is marked with a valid time range and contains TMCs and their corresponding travel speeds for the given time span. The network dataset opens a DTF file only if the time and date that the edge is being queried for is within the DTF file's valid time range. In many cases, multiple DTF files have valid time ranges that are within the queried time. This can occur when live traffic includes traffic predictions of a given depth; for example, for the next 12 hours. If multiple, valid files exist for the queried time, the file that was created immediately before the queried time is opened.
Once the DTF file is opened, the TMC and its associated travel speeds are combined with the length of the queried edge to determine the actual travel time.
If a valid TMC value or DTF file can't be found, the network dataset falls back to historical traffic to retrieve the travel time. And if historical travel times don't exist, it falls back to either a weekend- or weekday-specific network cost attribute, depending on what day of the week the edge is being queried for. This fallback sequence is set out in the edge traffic evaluators of the traffic-based cost attribute.
Creating DTF files
The far right side of the illustration above shows how DTF files are generated. A traffic feed, which is a web service and typically provided by a data vendor, is accessed using the Update Traffic Data geoprocessing tool. The tool reads data from the traffic feed and translates and stores the information into a DTF file, which is then saved to a file system folder.
The travel speeds in the DTF file are current at the time the file is created. To ensure the latest traffic data is available, run Update Traffic Data frequently or automate the generating of DTF files. One way to automatically generate new DTF files at fixed intervals, such as every 5 minutes, is by creating a Python script that runs Update Traffic Data, then run the script at regular intervals using Windows Task Scheduler.
The folder where the DTF files are stored can be shared and accessed locally via a UNC or local path.
Streets-TMC join table
The Streets-TMC join table furnishes the information needed to relate edges to speed values that are stored in DTF files. Typically, this table is provided by a data vendor along with street data.
The table below lists the required fields of a Streets-TMC join table, an example field name, their allowed data types, and a short description.
Field | Field name examples | Data type | Description |
---|---|---|---|
Edge feature class identifier | EdgeFCID You must name this field EdgeFCID. | Long integer | Identifies the feature class in which the street feature is stored. |
Edge feature identifier | EdgeFID You must name this field EdgeFID. | Long integer | Identifies the street feature. |
Edge from position | EdgeFrmPos You must name this field EdgeFrmPos. | Double | Works in conjunction with EdgeToPos to identify a direction of travel or side of the street. Zero indicates the beginning of the line feature as defined by its digitized direction. One indicates the opposite end. For example, an EdgeFrmPos value of 0 and an EdgeToPos value of 1 would identify travel in the digitized direction of the line feature. The TMC value listed in the same record would represent that side of the street only. Any decimal values specify a position along the digitized direction of the feature, which allows the Dissolve Network tool to maintain the proper TMC values for streets after edges have been dissolved together. |
Edge to position | EdgeToPos You must name this field EdgeToPos. | Double | Works in conjunction with EdgeFrmPos to identify a direction of travel, or side of the street. |
TMC code | TMC | String | The TMC code representing the associated road segment. |
Overview of setting up and updating live traffic data
The following list provides an overview of what you need to do prior to setting up live traffic.
Prepare your source features and associated tables in a geodatabase because traffic cannot be configured in a shapefile workspace.
Make sure that your edge source features are related to TMC values in a Streets-TMC join table. Note that you don't need to create relationship classes; the records in the Streets-TMC table simply need to identify a TMC and its corresponding source feature class, source feature (or features), and the from- and to-positions along the feature.
Make sure that you have the necessary tables for historical traffic since setting up historical traffic is required to set up live traffic.
Ensure that the Update Traffic Data geoprocessing tool runs periodically so that the live traffic is kept current. (This step can be done prior to or after the network dataset is created.)
- Make sure that you have the proper information to set up a time-zone attribute.
Learn how to configure live traffic in a new network dataset