跳至內容
tdx-tw
使用指南

路況與道路事件

查詢偵測器、攝影機、資訊看板、eTag、路段路況與道路事件。

路況

路況可依縣市查詢,或以 TrafficArea 指定國道與省道:

from tdx.traffic import TrafficArea

for section in client.traffic.section_observations(TrafficArea.FREEWAY):
    print(section.id, section.speed, section.travel_time, section.congestion_level)

for camera in client.traffic.cameras("Taipei", limit=20):
    print(camera.road_name, camera.stream_url)
設備基本資料即時資料
車輛偵測器detectorsdetector_observations
資訊可變標誌message_signssign_observations
攝影機cameras攝影機的 stream_url 與 image_url
eTagetag_gantries、etag_pairsetag_observations
路段sections、section_links、section_shapessection_observations

congestion_scales 說明壅塞程度的定義,news 為最新路況消息。設備與路段的方法可用 identifier 只取得一筆。

道路事件

for event in client.road_events.live_events("Taipei"):
    print(event.title, event.description, event.effective_at)

events 為預告的施工與封閉等事件,live_events 為目前發生中的事件。事件的 impact 說明車道影響與改道資訊。

所有參數與欄位見路況 API 與道路事件 API。

本頁目錄