GTFS Realtime 總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
即時為使用者提供最新的大眾運輸資料,可大幅提升大眾運輸服務體驗。只要提供目前抵達和離開時間的最新資訊,使用者就能順利規劃行程。因此,萬一不幸遇到誤點,乘客也能從容應對,知道自己不用太早出門。
GTFS Realtime 是一種動態饋給規格,方便大眾運輸公司為應用程式開發人員提供自家車隊的即時更新資訊。GTFS Realtime 是 GTFS (一般大眾運輸動態饋給規格) 的擴充內容,也是大眾運輸時間表及相關地理資訊的公開資料格式。GTFS Realtime 在設計時的核心理念是便於實作、良好的 GTFS 互通性,以及重視乘客資訊。
這個規格是與最初大眾運輸工具即時路況更新合作夥伴運輸公司、多位大眾運輸開發人員和 Google 攜手合作制定而成,並依據阿帕契 2.0 授權發布。
什麼是 Google 地圖的大眾運輸工具即時路況更新?
大眾運輸工具即時路況更新這項服務為 Google 地圖和 Google 地圖行動版使用者提供大眾運輸工具的即時路況更新資訊,包括轉運站的即時出發和抵達時間,以及服務快訊。
大眾運輸工具即時路況更新提供兩種即時更新資訊:即時出發時間和服務快訊。大眾運輸合作夥伴會在他們的動態饋給中提供這些更新資訊。我們建立了 GTFS Realtime 動態饋給格式,來補充靜態大眾運輸時間表廣為使用的 GTFS 格式的不足之處。您的動態饋給必須在我們可定期擷取的位置提供。系統會立即將動態饋給更新視為大眾運輸工具即時路況更新資訊來處理。
如何開始?
- 繼續閱讀下方總覽。
- 決定您要提供的動態饋給實體。
- 查看動態饋給範例。
- 根據參考資料自行建立動態饋給。
- 發布動態饋給。
GTFS Realtime 動態饋給總覽
這個規格目前支援下列類型的資訊:
- 行程更新 - 誤點、取消、路線異動
- 服務快訊 - 停靠站遷移;影響車站、路線或整個交通網的突發事件
- 車輛位置 - 車輛相關資訊,包括位置和壅塞程度
動態饋給可以 (但不一定要) 合併不同類型的實體,且會透過 HTTP 提供,並經常更新。檔案本身是一般二進位檔案,因此任何類型的網路伺服器都能代管及提供檔案 (也可採用其他傳輸通訊協定)。或者,也可以使用網頁應用程式伺服器,這類伺服器會傳回動態饋給,以回應有效的 HTTP GET
要求。動態饋給的更新/擷取頻率和確切方法沒有任何限制。
您可以運用 GTFS Realtime 呈現車隊的「實際」狀態,因此動態饋給必須定期更新 (建議在每次自動車輛定位系統提供新資料時更新)。
進一步瞭解動態饋給實體
GTFS Realtime 資料交換格式是以通訊協定緩衝區為基礎
通訊協定緩衝區是用於序列化結構化資料的語言和平台中立機制 (類似 XML,但更小、更快,也更簡單)。資料結構是在 gtfs-realtime.proto 檔案中定義,這個檔案隨後會用於產生原始碼,以便透過各種語言 (例如 Java、C++ 或 Python) 在各種資料串流中輕鬆地讀取及寫入結構化資料。
進一步瞭解通訊協定緩衝區。
資料結構
元素階層及元素類型定義是在 gtfs-realtime.proto 檔案中指定。
系統會使用您選擇的程式設計語言,將這個文字檔案用於產生必要的程式庫。這些程式庫會提供所需的類別和函式,以產生有效的 GTFS Realtime 動態饋給。程式庫不僅可簡化動態饋給的製作程序,還能確保製作出有效的動態饋給。
進一步瞭解資料結構
取得協助
如要一同討論 GTFS Realtime 並提議修改及補充規格內容,請加入 GTFS Realtime 郵寄清單。
Google 地圖和大眾運輸工具即時路況更新
大眾運輸工具即時路況更新是 Google 地圖中的一項功能,可為使用者提供即時大眾運輸資訊。如果您任職的大眾運輸公司想向 Google 地圖提供即時更新資訊,請前往 Google 大眾運輸合作夥伴頁面。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eGTFS Realtime allows public transportation agencies to provide real-time updates, like delays and vehicle positions, to applications, enhancing the rider experience.\u003c/p\u003e\n"],["\u003cp\u003eThe data is provided in a feed based on Protocol Buffers, allowing for efficient and flexible data exchange.\u003c/p\u003e\n"],["\u003cp\u003eLive Transit Updates within Google Maps uses GTFS Realtime feeds to give users access to real-time departure times and service alerts.\u003c/p\u003e\n"],["\u003cp\u003eTransit agencies can create their own feeds using the provided specification and examples to integrate their data with applications like Google Maps.\u003c/p\u003e\n"],["\u003cp\u003eThe GTFS Realtime specification was designed with ease of implementation in mind and focuses on providing accurate passenger information.\u003c/p\u003e\n"]]],["GTFS Realtime provides transit agencies a method to share live updates with app developers, enhancing user experience with real-time arrival/departure times and service alerts. Key information types include trip updates (delays, cancellations), service alerts (station issues), and vehicle positions. Agencies can start by defining feed entities, reviewing examples, creating feeds using provided references, and publishing the feed. Feeds use Protocol Buffers, a structured data format, and are updated regularly via HTTP. Agencies interested in Google Maps integration can visit the Google Transit Partner Page.\n"],null,["# GTFS Realtime Overview\n\n| **Note:** To see a detailed list of recommended practices for feeds about realtime public transportation information, refer to the [GTFS Realtime Best Practices](https://gtfs.mobilitydata.org/best-practices/gtfs-realtime) on the Mobility Data site.\n\nProviding users transit data updates in real time greatly enhances their experience of your transit services. Providing up-to-date information about current arrival and departure times allows users to smoothly plan their trips. As a result, in case of an unfortunate delay, a rider would be relieved to know that they can stay home a little bit longer.\n\nGTFS Realtime is a feed specification that allows public transportation agencies to provide realtime updates about their fleet to application developers. It is an extension to [GTFS](/transit/gtfs#SubmitFeedToGoogle) (General Transit Feed Specification), an open data format for public transportation schedules and associated geographic information. GTFS Realtime was designed around ease of implementation, good GTFS interoperability and a focus on passenger information.\n\nThe specification was designed through a partnership of the initial [Live Transit Updates](/transit/gtfs-realtime#what_is_live_transit_updates_for_google_maps) partner agencies, a number of transit developers and Google. The specification is published under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html).\n\nWhat is Live Transit Updates for Google Maps?\n---------------------------------------------\n\nLive Transit Updates is a service providing real-time transit updates to users of Google Maps and Google Maps for mobile. These updates include live departure and arrival times to transit stations and service alerts.\n\nLive Transit Updates provide two types of real-time updates to users: live departure times and service alerts. Transit partners provide these updates in their feeds. We created the GTFS realtime feed format to complement the widely-used GTFS format for static transit schedules. Your feed needs to be available on a location where we can fetch it periodically. The system immediately processes feed updates as Live Transit Updates information.\n\nHow do I start?\n---------------\n\n1. Continue reading the overview below.\n2. Decide which [feed entities](/transit/gtfs-realtime/guides/feed-entities) you will be providing.\n3. Take a look at [example feeds](/transit/gtfs-realtime/examples).\n4. Create your own feeds using the [reference](/transit/gtfs-realtime/reference).\n5. Publish your feed.\n\nOverview of GTFS Realtime feeds\n-------------------------------\n\nThe specification currently supports the following types of information:\n\n- **Trip updates** - delays, cancellations, changed routes\n- **Service alerts** - stop moved, unforeseen events affecting a station, route or the entire network\n- **Vehicle positions** - information about the vehicles including location and congestion level\n\nA feed may, although not required to, combine entities of different types. Feeds are served via HTTP and updated frequently. The file itself is a regular binary file, so any type of webserver can host and serve the file (other transfer protocols might be used as well). Alternatively, web application servers could also be used which as a response to a valid HTTP `GET` request will return the feed. There are no constraints on how frequently nor on the exact method of how the feed should be updated or retrieved.\n\nBecause GTFS Realtime allows you to present the *actual* status of your fleet, the feed needs to be updated regularly - preferably whenever new data comes in from your Automatic Vehicle Location system.\n\n[More about feed entities...](/transit/gtfs-realtime/guides/feed-entities)\n\nData format\n-----------\n\nThe GTFS Realtime data exchange format is based on [Protocol Buffers](https://developers.google.com/protocol-buffers/)\n\nProtocol buffers are a language- and platform-neutral mechanism for serializing structured data (think XML, but smaller, faster, and simpler). The data structure is defined in a [gtfs-realtime.proto](/static/transit/gtfs-realtime/gtfs-realtime.proto) file, which then is used to generate source code to easily read and write your structured data from and to a variety of data streams, using a variety of languages -- e.g. Java, C++ or Python.\n\n[More about Protocol Buffers...](/protocol-buffers).\n\nData structure\n--------------\n\nThe hierarchy of elements and their type definitions are specified in the [gtfs-realtime.proto](/static/transit/gtfs-realtime/gtfs-realtime.proto) file.\n\nThis text file is used to generate the necessary libraries in your choice of programming language. These libraries provide the classes and functions needed for generating valid GTFS Realtime feeds. The libraries not only make feed creation easier but also ensure that only valid feeds are produced.\n\n[More about the data structure...](/transit/gtfs-realtime/reference)\n\nGetting Help\n------------\n\nTo participate in discussions around GTFS Realtime and suggest changes and additions to the specification, join the [GTFS Realtime mailing list](http://groups.google.com/group/gtfs-realtime).\n\nGoogle Maps and Live Transit Updates\n------------------------------------\n\n[Live Transit Updates](/transit/gtfs-realtime#what_is_live_transit_updates_for_google_maps) is a feature within Google Maps that provides users with realtime transit information. If you are working for a public transportation agency that is interested in providing realtime updates to Google Maps, please visit the [Google Transit Partner Page](http://maps.google.com/help/maps/transit/partners/live-updates.html)."]]