Live Traffic Data (arcpy)

摘要

提供与网络数据集中存储的实时交通信息相关的信息,例如“街道 - TMC”连接表和 DTF 文件的路径。

属性

属性说明数据类型
tmcTableName
(只读)

包含街道与流量消息通道 (TMC) 代码之间关系的表的名称。

String
tmcFieldName
(只读)

包含 TMC 代码的街道-TMC 连接表中的字段名称。

String
trafficFeedLocation
(只读)

DTF 文件存储位置的路径。网络数据集从此位置读取 DTF 文件以获取实时流量数据。

String

代码实例

实时交通数据属性示例

显示网络数据集实时交通信息的摘要。

# 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
5/10/2014