服務快訊範例
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
以下範例是採 ASCII 表示法的服務快訊動態饋給。在此範例中,快訊會套用到通過停靠站 16230 的所有行程,以及屬於路線 219 且造訪停靠站 16130 的行程。
如要進一步瞭解如何建構服務快訊動態饋給,請參閱「快訊總覽」一文。
# header information
header {
# version of speed specification. Currently "2.0".
gtfs_realtime_version: "2.0"
# DIFFERENTIAL is unsupported. use FULL_DATASET only
incrementality: FULL_DATASET
# the moment where this dataset was generated on the server
timestamp: 1658283241
}
# multiple entities can be included in the feed
entity {
# unique identifier for the entity within the feed
id: "0"
# "type" of the entity
alert {
# multiple periods can be defined. active_period defines
# the time period that the alert is applied to the selectors
active_period {
# either start time or end time must be present
# one of them can be omitted but not both
# start time in seconds after epoch
start: 1658283241
# end time in seconds after epoch
end: 1658293845
}
# multiple selectors can be given to select the affected entities
# selectors are applied with a logical OR relationship across
# informed_entity messages along with a logical AND relationship
# for parameters in each informed_entity
informed_entity {
# valid parameters:
# agency_id, route_id, route_type, direction_id, stop_id, trip
route_id: "219"
stop_id: "16130"
}
informed_entity {
stop_id: "16230"
}
# system may use the cause and effect to judge the alert severity
# see https://support.google.com/transitpartners/answer/10104458
# cause of the alert - see gtfs-realtime.proto for valid values
cause: CONSTRUCTION
# effect of the alert - see gtfs-realtime.proto for valid values
effect: DETOUR
# the given url provides additional information
url {
# multiple languages/translations supported
translation {
# the link points to a webpage with more details of the alert
text: "http://www.sometransitagency/alerts"
# language code must be BCP-47, if defined
language: "en"
}
}
# header of the alert
header_text {
# multiple languages/translations supported
translation {
text: "Stop at Elm street is closed, temporary stop at Oak street"
language: "en"
}
}
# alert description. additional info to the header text
description_text {
# multiple languages/translations supported
translation {
text: "Due to construction at Elm street the stop is closed. The temporary stop can be found 300 meters north at Oak street"
language: "en"
}
}
}
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eThis document outlines an example of a Service Alert feed in the General Transit Feed Specification Realtime (GTFS-realtime) format.\u003c/p\u003e\n"],["\u003cp\u003eThe provided example demonstrates an alert affecting trips passing through stop 16230 and trips on route 219 visiting stop 16130.\u003c/p\u003e\n"],["\u003cp\u003eThe alert informs about a construction-related detour, with a temporary stop replacing the closed stop at Elm street.\u003c/p\u003e\n"],["\u003cp\u003eFurther details on creating Service Alert feeds can be found in the linked Google Transit Partner Help article.\u003c/p\u003e\n"]]],["This document details an example Service Alert feed. The feed includes header information such as version, incrementality, and timestamp. It defines an alert entity active between specified start and end times (1658283241 and 1658293845). The alert applies to trips on route 219 at stop 16130 and all trips through stop 16230. The alert's cause is \"CONSTRUCTION,\" the effect is \"DETOUR,\" and it provides a URL, header, and description with further information.\n"],null,["# Service Alert example\n\nThe following example is an ASCII representation of a Service Alert feed. In\nthis example, an alert is applied to all trips that go through stop 16230 and to\ntrips that belong to route 219 and visit stop 16130.\n\nFor more details on how to construct a Service Alert feed, see [Alerts\noverview](https://support.google.com/transitpartners/answer/10105059). \n\n # header information\n header {\n # version of speed specification. Currently \"2.0\".\n gtfs_realtime_version: \"2.0\"\n\n # DIFFERENTIAL is unsupported. use FULL_DATASET only\n incrementality: FULL_DATASET\n\n # the moment where this dataset was generated on the server\n timestamp: 1658283241\n }\n # multiple entities can be included in the feed\n entity {\n # unique identifier for the entity within the feed\n id: \"0\"\n\n # \"type\" of the entity\n alert {\n # multiple periods can be defined. active_period defines \n # the time period that the alert is applied to the selectors\n active_period {\n # either start time or end time must be present\n # one of them can be omitted but not both\n # start time in seconds after epoch\n start: 1658283241\n # end time in seconds after epoch\n end: 1658293845\n }\n\n # multiple selectors can be given to select the affected entities\n # selectors are applied with a logical OR relationship across \n # informed_entity messages along with a logical AND relationship \n # for parameters in each informed_entity\n informed_entity {\n # valid parameters:\n # agency_id, route_id, route_type, direction_id, stop_id, trip\n route_id: \"219\"\n stop_id: \"16130\"\n }\n informed_entity {\n stop_id: \"16230\"\n }\n\n # system may use the cause and effect to judge the alert severity\n # see https://support.google.com/transitpartners/answer/10104458\n # cause of the alert - see gtfs-realtime.proto for valid values\n cause: CONSTRUCTION\n # effect of the alert - see gtfs-realtime.proto for valid values\n effect: DETOUR\n\n # the given url provides additional information\n url {\n # multiple languages/translations supported\n translation {\n # the link points to a webpage with more details of the alert\n text: \"http://www.sometransitagency/alerts\"\n # language code must be BCP-47, if defined\n language: \"en\"\n }\n }\n\n # header of the alert\n header_text {\n # multiple languages/translations supported\n translation {\n text: \"Stop at Elm street is closed, temporary stop at Oak street\"\n language: \"en\"\n }\n }\n\n # alert description. additional info to the header text\n description_text {\n # multiple languages/translations supported\n translation {\n text: \"Due to construction at Elm street the stop is closed. The temporary stop can be found 300 meters north at Oak street\"\n language: \"en\"\n }\n }\n }\n }"]]