Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page describes how Samtrafiken maps Noptis data to GTFS-realtime data. For a complete specification of the GTFS-realtime format, please see http://gtfs.org/reference/realtime/v1/.

Header

...

Message: FeedHeader

GTFS-RT

Value

header.gtfs_realtime_version

“2.0”

header.incrementality

FULL_DATASET

header.timestamp

UTC time in seconds of file creation. Example: 1611582680.

Alert

...

Message: FeedEntity

GTFS-RT

NOPTIS

id

For TripUpdate: DeviationMessageVersion

  • DatedVehicleJourney.Id

alert.active_period.start

DeviationMessageVersion.PublishFromDateTime

alert.active_period.end

DeviationMessageVersion.PublishUpToDateTime

alert.header_text.translation.text

DeviationMessage.Content (UsageTypeShortName=HEADER)
OR
DeviationMessageVersion.PublicNote

alert.description_text.translation.text

DeviationMessage.Content (UsageTypeShortName=DETAILS)
OR
DeviationMessageVersion.PublicNote

alert.cause

UNKNOWN_CAUSE
OR
DeviationReasonStandardCategoryCode → alert.cause

  • MEDICAL → MEDICAL_EMERGENCY

  • POLICEDECISION → POLICE_ACTIVITY

  • ROADWORK → CONSTRUCTION

  • MAINTENANCE → MAINTENANCE

  • WEATHER → WEATHER

  • ACCIDENT → ACCIDENT

  • STRIKE → STRIKE

  • VEHICLEBREAKDOWN, TECHNICALFAILURE → TECHNICAL_PROBLEM

  • ELSE OTHER_CAUSE

alert.informed_entity.route_id

Line.Gid

alert.informed_entity.stop_id

StopPoint.Gid
OR
StopArea.Gid

alert.informed_entity.agency_id

TransportAuthority.Id

alert.informed_entity.trip.trip_id

VehicleJourney.Id

alert.informed_entity.trip.schedule_relationship

If a vehicle journey exists, then SCHEDULED, else field is not included

Trip updates

...

For VehiclePosition:

  • Position.Nr (where Position refers to a POSROI message)

For Alert:

  • DeviationMessageVersion.Id

Message: TripUpdate

File: TripUpdates.pb
When trip updates are generated, stop time updates with departure or arrival times that are considered too old are excluded. A departure/arrival is considered too old if the vehicle left the stop 10 minutes ago.

DatedVehicleJourney.Id

GTFS-RT

NOPTIS

id

trip_update.trip.trip_id

If a vehicle journey exists, then VehicleJourney.Id is used.
If a a vehicle journey does not exists and route_id and direction_id cannot be resolved, then DatedVehicleJourney.Id is used.

trip_update.trip.route_id

Line.Gid

trip_update.trip.direction_id

DirectionOfLine.DirectionCode → direction_id

  • EVEN → 0

  • ODD → 1

trip_update.trip.start_time

DatedVehicleJourney.TimetabledStartDateTime

trip_update.trip.start_date

DatedVehicleJourney.TimetabledStartDateTime

trip_update.trip.schedule_relationship

If a DatedVehicleJourney.VehicleJourneyState exists and is canceled, then set to CANCELED.
If a vehicle journey exists , then set to SCHEDULED, else ADDED

trip_update.vehicle.id

MonitoredVehicleJourney.IsAssignedToVehicleGid

trip_update.stop_time_update.stop_id

StopPoint.Gid

trip_update.stop_time_update.stop_sequence

Departure.JourneyPatternSequenceNumber
OR
Arrival.JourneyPatternSequenceNumber

trip_update.stop_time_update.arrival.delay

Based on predicted arrival time and scheduled arrival time

trip_update.stop_time_update.arrival.time

Arrival.ObservedDateTime or Arrival.TargetDateTime
OR
if arrival is after departure (unless last stop), then:
Departure.ObservedDateTime or Departure.TargetDateTime

trip_update.stop_time_update.arrival.uncertainty

0 if Arrival.ObservedDateTime is set and is after the used departure time (or is at last stop)

trip_update.stop_time_update.arrival.schedule_relationship

SKIPPED if Arrival.ArrivalState is set to canceled, else omitted

trip_update.stop_time_update.departure.delay

Based on predicted departure time and scheduled departure time

trip_update.stop_time_update.departure.time

Departure.ObservedDateTime or Departure.TargetDateTime
OR
if last stop then:
Arrival.ObservedDateTime or Arrival.TargetDateTime

trip_update.stop_time_update.departure.uncertainty

0 if Departure.ObservedDateTime is set

trip_update.stop_time_update.departure.schedule_relationship

SKIPPED if Departure.DepartureState is set to canceled, else omittedtrip_update.

vehicle.id

MonitoredVehicleJourney.IsAssignedToVehicleGid

timestamp

Departure.Timestamp
OR
Arrival.Timestamp

The latest timestamp overall in the list of departures and arrivals in the current trip update

...

Message VehiclePosition

FilesFile: Vehiclepositions.txt and Vehiclepositions.pb.
Entity Position in the below table refers to a POSROI message.

Position.Nr

GTFS-RT

NOPTIS

Comment

id

vehicle.trip.trip_id

VehicleJourney.Id

If a scheduled journey exists, then trip_id is used for identification, else route_id and direction_id is used.

vehicle.trip.route_id

Line.Gid

vehicle.trip.direction_id

DirectionOfLine.DirectionCode → direction_id

  • EVEN → 0

  • ODD → 1

vehicle.trip.start_time

DatedVehicleJourney.TimetabledStartDateTime

Is only included if a trip is unscheduled.

vehicle.trip.start_date

DatedVehicleJourney.TimetabledStartDateTime

Is only included if a trip is unscheduled.

vehicle.trip.schedule_relationship

If vehicle journey exists, then SCHEDULED, else ADDED.

vehicle.position.latitude

Position.Northing

vehicle.position.longitude

Position.Easting

vehicle.position.bearing

Position.Heading

vehicle.position.speed

Position.Speed

vehicle.id

Position.Vehicle

timestamp

Position.Timestamp

vehicle.vehicle.id

Position.Vehicle

Message Alert

File: ServiceAlerts.pb.

GTFS-RT

NOPTIS

active_period.start

DeviationMessageVersion.PublishFromDateTime

active_period.end

DeviationMessageVersion.PublishUpToDateTime

header_text.translation.text

DeviationMessage.Content (UsageTypeShortName=HEADER)
OR
DeviationMessageVersion.PublicNote

description_text.translation.text

DeviationMessage.Content (UsageTypeShortName=DETAILS)
OR
DeviationMessageVersion.PublicNote

cause

UNKNOWN_CAUSE
OR
DeviationReasonStandardCategoryCode → alert.cause

  • MEDICAL → MEDICAL_EMERGENCY

  • POLICEDECISION → POLICE_ACTIVITY

  • ROADWORK → CONSTRUCTION

  • MAINTENANCE → MAINTENANCE

  • WEATHER → WEATHER

  • ACCIDENT → ACCIDENT

  • STRIKE → STRIKE

  • VEHICLEBREAKDOWN, TECHNICALFAILURE → TECHNICAL_PROBLEM

  • ELSE OTHER_CAUSE

informed_entity.route_id

Line.Gid

informed_entity.stop_id

StopPoint.Gid
OR
StopArea.Gid

informed_entity.agency_id

TransportAuthority.Id

informed_entity.trip.trip_id

VehicleJourney.Id

informed_entity.trip.schedule_relationship

If a vehicle journey exists, then SCHEDULED, else field is not included