gtfs/realtime/types

GTFS Realtime Types

Type definitions for GTFS Realtime Protocol Buffer messages. Based on gtfs-realtime.proto specification. Source: https://github.com/google/transit/blob/master/gtfs-realtime/proto/gtfs-realtime.proto

Types

An alert indicating some sort of incident in the public transit network.

pub type Alert {
  Alert(
    active_period: List(TimeRange),
    informed_entity: List(EntitySelector),
    cause: AlertCause,
    effect: AlertEffect,
    url: option.Option(TranslatedString),
    header_text: option.Option(TranslatedString),
    description_text: option.Option(TranslatedString),
    tts_header_text: option.Option(TranslatedString),
    tts_description_text: option.Option(TranslatedString),
    severity_level: SeverityLevel,
    image: option.Option(TranslatedImage),
    image_alternative_text: option.Option(TranslatedString),
    cause_detail: option.Option(TranslatedString),
    effect_detail: option.Option(TranslatedString),
  )
}

Constructors

Cause of an alert

pub type AlertCause {
  UnknownCause
  OtherCause
  TechnicalProblem
  Strike
  Demonstration
  Accident
  Holiday
  Weather
  Maintenance
  Construction
  PoliceActivity
  MedicalEmergency
}

Constructors

  • UnknownCause
  • OtherCause
  • TechnicalProblem
  • Strike
  • Demonstration
  • Accident
  • Holiday
  • Weather
  • Maintenance
  • Construction
  • PoliceActivity
  • MedicalEmergency

Effect of an alert

pub type AlertEffect {
  NoService
  ReducedService
  SignificantDelays
  Detour
  AdditionalService
  ModifiedService
  OtherEffect
  UnknownEffect
  StopMoved
  NoEffect
  AccessibilityIssue
}

Constructors

  • NoService
  • ReducedService
  • SignificantDelays
  • Detour
  • AdditionalService
  • ModifiedService
  • OtherEffect
  • UnknownEffect
  • StopMoved
  • NoEffect
  • AccessibilityIssue

Carriage-specific details for multi-carriage vehicles (experimental)

pub type CarriageDetails {
  CarriageDetails(
    id: option.Option(String),
    label: option.Option(String),
    occupancy_status: OccupancyStatus,
    occupancy_percentage: Int,
    carriage_sequence: option.Option(Int),
  )
}

Constructors

  • CarriageDetails(
      id: option.Option(String),
      label: option.Option(String),
      occupancy_status: OccupancyStatus,
      occupancy_percentage: Int,
      carriage_sequence: option.Option(Int),
    )

    Arguments

    id

    Carriage identifier

    label

    User-visible label

    occupancy_status

    Occupancy status for this carriage

    occupancy_percentage

    Occupancy percentage (-1 if not available)

    carriage_sequence

    Order of this carriage (1 = first in direction of travel)

Congestion level

pub type CongestionLevel {
  UnknownCongestionLevel
  RunningSmoothly
  StopAndGo
  Congestion
  SevereCongestion
}

Constructors

  • UnknownCongestionLevel
  • RunningSmoothly
  • StopAndGo
  • Congestion
  • SevereCongestion

Drop off/pickup types for real-time updates

pub type DropOffPickupType {
  Regular
  NoPickupDropOff
  PhoneAgency
  CoordinateWithDriver
}

Constructors

  • Regular

    Regularly scheduled

  • NoPickupDropOff

    Not available

  • PhoneAgency

    Must phone agency

  • CoordinateWithDriver

    Must coordinate with driver

Selector for entities in a GTFS feed

pub type EntitySelector {
  EntitySelector(
    agency_id: option.Option(String),
    route_id: option.Option(String),
    route_type: option.Option(Int),
    trip: option.Option(TripDescriptor),
    stop_id: option.Option(String),
    direction_id: option.Option(Int),
  )
}

Constructors

A definition (or update) of an entity in the transit feed.

pub type FeedEntity {
  FeedEntity(
    id: String,
    is_deleted: Bool,
    trip_update: option.Option(TripUpdate),
    vehicle: option.Option(VehiclePosition),
    alert: option.Option(Alert),
    shape: option.Option(Shape),
    stop: option.Option(RealtimeStop),
    trip_modifications: option.Option(TripModifications),
  )
}

Constructors

Metadata about a feed, included in feed messages.

pub type FeedHeader {
  FeedHeader(
    gtfs_realtime_version: String,
    incrementality: Incrementality,
    timestamp: option.Option(Int),
    feed_version: option.Option(String),
  )
}

Constructors

  • FeedHeader(
      gtfs_realtime_version: String,
      incrementality: Incrementality,
      timestamp: option.Option(Int),
      feed_version: option.Option(String),
    )

    Arguments

    gtfs_realtime_version

    Version of the feed specification (“2.0” or “1.0”)

    incrementality

    Whether the current fetch is incremental

    timestamp

    Timestamp when the content was created (POSIX time)

    feed_version

    String that matches feed_info.feed_version from GTFS feed

The contents of a feed message. A feed is a continuous stream of feed messages.

pub type FeedMessage {
  FeedMessage(header: FeedHeader, entity: List(FeedEntity))
}

Constructors

  • FeedMessage(header: FeedHeader, entity: List(FeedEntity))

    Arguments

    header

    Metadata about this feed and feed message

    entity

    Contents of the feed - list of entities

Determines whether the current fetch is incremental

pub type Incrementality {
  FullDataset
  Differential
}

Constructors

  • FullDataset
  • Differential

A localized image

pub type LocalizedImage {
  LocalizedImage(
    url: String,
    media_type: String,
    language: option.Option(String),
  )
}

Constructors

  • LocalizedImage(
      url: String,
      media_type: String,
      language: option.Option(String),
    )

    Arguments

    url

    URL linking to the image

    media_type

    IANA media type (e.g., “image/png”)

    language

    BCP-47 language code (optional)

A modification to a trip

pub type Modification {
  Modification(
    start_stop_selector: option.Option(StopSelector),
    end_stop_selector: option.Option(StopSelector),
    propagated_modification_delay: Int,
    replacement_stops: List(ReplacementStop),
    service_alert_id: option.Option(String),
    last_modified_time: option.Option(Int),
  )
}

Constructors

  • Modification(
      start_stop_selector: option.Option(StopSelector),
      end_stop_selector: option.Option(StopSelector),
      propagated_modification_delay: Int,
      replacement_stops: List(ReplacementStop),
      service_alert_id: option.Option(String),
      last_modified_time: option.Option(Int),
    )

    Arguments

    start_stop_selector

    Start stop selector

    end_stop_selector

    End stop selector

    propagated_modification_delay

    Delay to add to following times

    replacement_stops

    Replacement stops

    service_alert_id

    ID of alert describing this modification

    last_modified_time

    Last modification timestamp

Modified trip selector (experimental)

pub type ModifiedTripSelector {
  ModifiedTripSelector(
    modifications_id: option.Option(String),
    affected_trip_id: option.Option(String),
    start_time: option.Option(String),
    start_date: option.Option(String),
  )
}

Constructors

  • ModifiedTripSelector(
      modifications_id: option.Option(String),
      affected_trip_id: option.Option(String),
      start_time: option.Option(String),
      start_date: option.Option(String),
    )

    Arguments

    modifications_id

    ID of the FeedEntity with TripModifications

    affected_trip_id

    Trip ID being modified

    start_time

    Start time (for frequency-based trips)

    start_date

    Start date (YYYYMMDD)

Occupancy status of the vehicle or carriage

pub type OccupancyStatus {
  Empty
  ManySeatsAvailable
  FewSeatsAvailable
  StandingRoomOnly
  CrushedStandingRoomOnly
  Full
  NotAcceptingPassengers
  NoDataAvailable
  NotBoardable
}

Constructors

  • Empty
  • ManySeatsAvailable
  • FewSeatsAvailable
  • StandingRoomOnly
  • CrushedStandingRoomOnly
  • Full
  • NotAcceptingPassengers
  • NoDataAvailable
  • NotBoardable

A position (latitude, longitude, bearing, etc.)

pub type Position {
  Position(
    latitude: Float,
    longitude: Float,
    bearing: option.Option(Float),
    odometer: option.Option(Float),
    speed: option.Option(Float),
  )
}

Constructors

  • Position(
      latitude: Float,
      longitude: Float,
      bearing: option.Option(Float),
      odometer: option.Option(Float),
      speed: option.Option(Float),
    )

    Arguments

    latitude

    Degrees North, WGS-84

    longitude

    Degrees East, WGS-84

    bearing

    Bearing in degrees, clockwise from North

    odometer

    Odometer value in meters

    speed

    Speed in meters per second

A stop served by trips (experimental)

pub type RealtimeStop {
  RealtimeStop(
    stop_id: option.Option(String),
    stop_code: option.Option(TranslatedString),
    stop_name: option.Option(TranslatedString),
    tts_stop_name: option.Option(TranslatedString),
    stop_desc: option.Option(TranslatedString),
    stop_lat: option.Option(Float),
    stop_lon: option.Option(Float),
    zone_id: option.Option(String),
    stop_url: option.Option(TranslatedString),
    parent_station: option.Option(String),
    stop_timezone: option.Option(String),
    wheelchair_boarding: RealtimeWheelchairBoarding,
    level_id: option.Option(String),
    platform_code: option.Option(TranslatedString),
  )
}

Constructors

Wheelchair boarding for realtime stops

pub type RealtimeWheelchairBoarding {
  RealtimeWheelchairUnknown
  RealtimeWheelchairAvailable
  RealtimeWheelchairNotAvailable
}

Constructors

  • RealtimeWheelchairUnknown
  • RealtimeWheelchairAvailable
  • RealtimeWheelchairNotAvailable

Replacement stop for modifications

pub type ReplacementStop {
  ReplacementStop(
    travel_time_to_stop: option.Option(Int),
    stop_id: option.Option(String),
  )
}

Constructors

  • ReplacementStop(
      travel_time_to_stop: option.Option(Int),
      stop_id: option.Option(String),
    )

    Arguments

    travel_time_to_stop

    Travel time to this stop from reference (seconds)

    stop_id

    Replacement stop ID

Selected trips for modifications

pub type SelectedTrips {
  SelectedTrips(
    trip_ids: List(String),
    shape_id: option.Option(String),
  )
}

Constructors

  • SelectedTrips(
      trip_ids: List(String),
      shape_id: option.Option(String),
    )

    Arguments

    trip_ids

    List of trip IDs affected

    shape_id

    New shape ID for modified trips

Severity level of an alert

pub type SeverityLevel {
  UnknownSeverity
  Info
  Warning
  Severe
}

Constructors

  • UnknownSeverity
  • Info
  • Warning
  • Severe

A shape that describes the vehicle’s travel path (experimental)

pub type Shape {
  Shape(
    shape_id: option.Option(String),
    encoded_polyline: option.Option(String),
  )
}

Constructors

  • Shape(
      shape_id: option.Option(String),
      encoded_polyline: option.Option(String),
    )

    Arguments

    shape_id

    Shape ID (different from GTFS shapes)

    encoded_polyline

    Encoded polyline representation

Stop selector for modifications

pub type StopSelector {
  StopSelector(
    stop_sequence: option.Option(Int),
    stop_id: option.Option(String),
  )
}

Constructors

  • StopSelector(
      stop_sequence: option.Option(Int),
      stop_id: option.Option(String),
    )

    Arguments

    stop_sequence

    Stop sequence

    stop_id

    Stop ID

Timing information for a single predicted event (arrival or departure)

pub type StopTimeEvent {
  StopTimeEvent(
    delay: option.Option(Int),
    time: option.Option(Int),
    uncertainty: option.Option(Int),
    scheduled_time: option.Option(Int),
  )
}

Constructors

  • StopTimeEvent(
      delay: option.Option(Int),
      time: option.Option(Int),
      uncertainty: option.Option(Int),
      scheduled_time: option.Option(Int),
    )

    Arguments

    delay

    Delay in seconds (positive = late, negative = early)

    time

    Event as absolute time (Unix timestamp)

    uncertainty

    Uncertainty of the prediction

    scheduled_time

    Scheduled time for NEW/REPLACEMENT/DUPLICATED trips (experimental)

Updated values for stop time (experimental)

pub type StopTimeProperties {
  StopTimeProperties(
    assigned_stop_id: option.Option(String),
    stop_headsign: option.Option(String),
    pickup_type: option.Option(DropOffPickupType),
    drop_off_type: option.Option(DropOffPickupType),
  )
}

Constructors

The relation between StopTimeEvents and the static schedule

pub type StopTimeScheduleRelationship {
  StopScheduled
  StopSkipped
  StopNoData
  StopUnscheduled
}

Constructors

  • StopScheduled

    Vehicle proceeding according to schedule

  • StopSkipped

    Stop is skipped

  • StopNoData

    No data for this stop

  • StopUnscheduled

    For frequency-based trips with exact_times=0

Realtime update for arrival/departure events for a given stop

pub type StopTimeUpdate {
  StopTimeUpdate(
    stop_sequence: option.Option(Int),
    stop_id: option.Option(String),
    arrival: option.Option(StopTimeEvent),
    departure: option.Option(StopTimeEvent),
    departure_occupancy_status: option.Option(OccupancyStatus),
    schedule_relationship: StopTimeScheduleRelationship,
    stop_time_properties: option.Option(StopTimeProperties),
  )
}

Constructors

A time range (start and/or end time)

pub type TimeRange {
  TimeRange(start: option.Option(Int), end: option.Option(Int))
}

Constructors

  • TimeRange(start: option.Option(Int), end: option.Option(Int))

    Arguments

    start

    Start time (POSIX time), or minus infinity if missing

    end

    End time (POSIX time), or plus infinity if missing

Internationalized image (experimental)

pub type TranslatedImage {
  TranslatedImage(localized_image: List(LocalizedImage))
}

Constructors

Internationalized text with translations

pub type TranslatedString {
  TranslatedString(translation: List(Translation))
}

Constructors

A single translation

pub type Translation {
  Translation(text: String, language: option.Option(String))
}

Constructors

  • Translation(text: String, language: option.Option(String))

    Arguments

    text

    The translated text (UTF-8)

    language

    BCP-47 language code (optional)

A descriptor that identifies an instance of a GTFS trip

pub type TripDescriptor {
  TripDescriptor(
    trip_id: option.Option(String),
    route_id: option.Option(String),
    direction_id: option.Option(Int),
    start_time: option.Option(String),
    start_date: option.Option(String),
    schedule_relationship: TripScheduleRelationship,
    modified_trip: option.Option(ModifiedTripSelector),
  )
}

Constructors

  • TripDescriptor(
      trip_id: option.Option(String),
      route_id: option.Option(String),
      direction_id: option.Option(Int),
      start_time: option.Option(String),
      start_date: option.Option(String),
      schedule_relationship: TripScheduleRelationship,
      modified_trip: option.Option(ModifiedTripSelector),
    )

    Arguments

    trip_id

    Trip ID from the GTFS feed

    route_id

    Route ID from the GTFS feed

    direction_id

    Direction ID (0 or 1)

    start_time

    Start time for frequency-based trips (HH:MM:SS)

    start_date

    Start date (YYYYMMDD)

    schedule_relationship

    Relationship to the static schedule

    modified_trip

    Linkage to modifications (experimental)

Trip modifications for detours, etc. (experimental)

pub type TripModifications {
  TripModifications(
    selected_trips: List(SelectedTrips),
    start_times: List(String),
    service_dates: List(String),
    modifications: List(Modification),
  )
}

Constructors

  • TripModifications(
      selected_trips: List(SelectedTrips),
      start_times: List(String),
      service_dates: List(String),
      modifications: List(Modification),
    )

    Arguments

    selected_trips

    List of selected trips affected

    start_times

    Start times for frequency-based trips

    service_dates

    Service dates (YYYYMMDD)

    modifications

    List of modifications

Updated properties of a trip (experimental)

pub type TripProperties {
  TripProperties(
    trip_id: option.Option(String),
    start_date: option.Option(String),
    start_time: option.Option(String),
    shape_id: option.Option(String),
    trip_headsign: option.Option(String),
    trip_short_name: option.Option(String),
  )
}

Constructors

  • TripProperties(
      trip_id: option.Option(String),
      start_date: option.Option(String),
      start_time: option.Option(String),
      shape_id: option.Option(String),
      trip_headsign: option.Option(String),
      trip_short_name: option.Option(String),
    )

    Arguments

    trip_id

    New trip_id for duplicated trips

    start_date

    Service date for duplicated trips (YYYYMMDD)

    start_time

    Start time for duplicated trips

    shape_id

    Shape ID when different from GTFS

    trip_headsign

    Updated headsign

    trip_short_name

    Updated short name

Trip schedule relationship

pub type TripScheduleRelationship {
  TripScheduled
  TripAdded
  TripUnscheduled
  TripCanceled
  TripReplacement
  TripDuplicated
  TripDeleted
  TripNew
}

Constructors

  • TripScheduled
  • TripAdded
  • TripUnscheduled
  • TripCanceled
  • TripReplacement
  • TripDuplicated
  • TripDeleted
  • TripNew

Realtime update of the progress of a vehicle along a trip.

pub type TripUpdate {
  TripUpdate(
    trip: TripDescriptor,
    vehicle: option.Option(VehicleDescriptor),
    stop_time_update: List(StopTimeUpdate),
    timestamp: option.Option(Int),
    delay: option.Option(Int),
    trip_properties: option.Option(TripProperties),
  )
}

Constructors

  • TripUpdate(
      trip: TripDescriptor,
      vehicle: option.Option(VehicleDescriptor),
      stop_time_update: List(StopTimeUpdate),
      timestamp: option.Option(Int),
      delay: option.Option(Int),
      trip_properties: option.Option(TripProperties),
    )

    Arguments

    trip

    The trip that this message applies to

    vehicle

    Additional information on the vehicle serving this trip

    stop_time_update

    Updates to StopTimes for the trip

    timestamp

    Timestamp of the most recent real-time progress measurement

    delay

    Current schedule deviation for the trip (seconds, positive = late)

    trip_properties

    Updated properties of the trip (experimental)

Identification information for a vehicle

pub type VehicleDescriptor {
  VehicleDescriptor(
    id: option.Option(String),
    label: option.Option(String),
    license_plate: option.Option(String),
    wheelchair_accessible: WheelchairAccessible,
  )
}

Constructors

  • VehicleDescriptor(
      id: option.Option(String),
      label: option.Option(String),
      license_plate: option.Option(String),
      wheelchair_accessible: WheelchairAccessible,
    )

    Arguments

    id

    Internal system ID of the vehicle

    label

    User-visible label

    license_plate

    License plate

    wheelchair_accessible

    Wheelchair accessibility

Realtime positioning information for a given vehicle.

pub type VehiclePosition {
  VehiclePosition(
    trip: option.Option(TripDescriptor),
    vehicle: option.Option(VehicleDescriptor),
    position: option.Option(Position),
    current_stop_sequence: option.Option(Int),
    stop_id: option.Option(String),
    current_status: VehicleStopStatus,
    timestamp: option.Option(Int),
    congestion_level: CongestionLevel,
    occupancy_status: option.Option(OccupancyStatus),
    occupancy_percentage: option.Option(Int),
    multi_carriage_details: List(CarriageDetails),
  )
}

Constructors

Vehicle stop status

pub type VehicleStopStatus {
  IncomingAt
  StoppedAt
  InTransitTo
}

Constructors

  • IncomingAt

    Vehicle just about to arrive at the stop

  • StoppedAt

    Vehicle standing at the stop

  • InTransitTo

    Vehicle in transit to the next stop

Wheelchair accessibility for a vehicle

pub type WheelchairAccessible {
  WheelchairNoValue
  WheelchairUnknown
  WheelchairAccessibleVehicle
  WheelchairInaccessible
}

Constructors

  • WheelchairNoValue

    No information (default, doesn’t override GTFS)

  • WheelchairUnknown

    Unknown accessibility (overrides GTFS)

  • WheelchairAccessibleVehicle

    Vehicle is wheelchair accessible

  • WheelchairInaccessible

    Vehicle is not wheelchair accessible

Search Document