服务提醒示例

以下示例是服务提醒 Feed 的 ASCII 表示法。在此示例中,系统会将提醒应用于经停 16230 号经停点的所有行程,以及属于 219 号路线且经过 16130 号经停点的行程。

如需详细了解如何构建服务提醒 Feed,请参阅提醒概览

# 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"
      }
    }
  }
}