Live Traffic Data

Résumé

Provides information about the live traffic information stored in the network dataset such as the streets—TMC join table and the path to the DTF files.

Propriétés

PropriétéExplicationType de données
tmcTableName
(Lecture seule)

The name of the table that contains the relationship between streets and traffic messaging channel (TMC) codes.

String
tmcFieldName
(Lecture seule)

The name of the field within the Streets—TMC join table that contains the TMC codes.

String
trafficFeedLocation
(Lecture seule)

The source of the live traffic feed. This can be the path to a folder or a service where DTF files are stored; the network dataset reads the DTF files from the specified location to get the live traffic data.

String
trafficFeedType
(Lecture seule)

The type of live traffic feed. Choices include the following:

  • Service—The traffic feed uses a service.
  • Folder—The traffic feed uses a folder that stores DTF files.
  • None—The traffic feed is not currently configured.

String

Exemple de code

Live Traffic Data Properties example

Display a summary of the live traffic information for the network dataset.

# Name: NDSLiveTrafficDataProperties_ex01.py
# Description: Print live traffic information for the network dataset.

import arcpy
import sys

# Set the workspace
arcpy.env.workspace = "C:/Data/SanDiego.gdb/Transportation"

# Create Describe object for the network dataset
desc = arcpy.Describe("Streets_ND")

#Get the historical traffic data object
if desc.supportsLiveTrafficData:
    traffic = desc.liveTrafficData
else:
    #If the directions are not set for the network dataset, exit
    print "No live traffic information"
    sys.exit()

print("Live Traffic Information ----")
print("TMC Table Name: " , traffic.tmcTableName)
print("TMC Field Name: " , traffic.tmcFieldName)
print("Traffic Feed: " , traffic.trafficFeedLocation)