Skip to content

Updater configuration

This section covers all options that can be set in the router-config.json in the updaters section.

Real-time data are those that are not added to OTP during the graph build phase but during runtime.

Real-time data sources are configured in the updaters section is an array of JSON objects, each of which has a type field and other configuration fields specific to that type.

GTFS-Realtime

GTFS feeds contain schedule data that is published by an agency or operator in advance. The feed does not account for unexpected service changes or traffic disruptions that occur from day to day. Thus, this kind of data is also referred to as 'static' data or 'theoretical' arrival and departure times.

GTFS-Realtime complements GTFS with three additional kinds of feeds. In contrast to the base GTFS schedule feed, they provide real-time updates ('dynamic' data) and are updated from minute to minute.

Alerts

Alerts are text messages attached to GTFS objects, informing riders of disruptions and changes. The information is downloaded in a single HTTP request and polled regularly.

Config Parameter Type Summary Req./Opt. Default Value Since
type = "real-time-alerts" enum The type of the updater. Required 1.5
earlyStartSec integer How long before the posted start of an event it should be displayed to users Optional 0 1.5
feedId string The id of the feed to apply the alerts to. Optional 1.5
frequency duration How often the URL should be fetched. Optional "PT1M" 1.5
fuzzyTripMatching boolean Whether to match trips fuzzily. Optional false 1.5
url string URL to fetch the GTFS-RT feed from. Required 1.5
headers map of string HTTP headers to add to the request. Any header key, value can be inserted. Optional 2.3
Parameter details

headers

Since version: 2.3Type: map of stringCardinality: Optional
Path: /updaters/[0]

HTTP headers to add to the request. Any header key, value can be inserted.

Example configuration
// router-config.json
{
  "updaters" : [
    {
      "type" : "real-time-alerts",
      "frequency" : "30s",
      "url" : "http://developer.trimet.org/ws/V1/FeedSpecAlerts/appID/0123456789ABCDEF",
      "feedId" : "TriMet",
      "headers" : {
        "Some-Header" : "A-Value"
      }
    }
  ]
}

TripUpdates via HTTP(S)

TripUpdates report on the status of scheduled trips as they happen, providing observed and predicted arrival and departure times for the remainder of the trip. The information is downloaded in a single HTTP request and polled regularly.

Config Parameter Type Summary Req./Opt. Default Value Since
type = "stop-time-updater" enum The type of the updater. Required 1.5
backwardsDelayPropagationType enum How backwards propagation should be handled. Optional "required-no-data" 2.2
feedId string Which feed the updates apply to. Optional 1.5
frequency duration How often the data should be downloaded. Optional "PT1M" 1.5
fuzzyTripMatching boolean If the trips should be matched fuzzily. Optional false 1.5
url string The URL of the GTFS-RT resource. Required 1.5
headers map of string HTTP headers to add to the request. Any header key, value can be inserted. Optional 2.3
Parameter details

backwardsDelayPropagationType

Since version: 2.2Type: enumCardinality: OptionalDefault value: "required-no-data"
Path: /updaters/[5]
Enum values: required-no-data | required | always

How backwards propagation should be handled.

REQUIRED_NO_DATA: Default value. Only propagates delays backwards when it is required to ensure that the times are increasing, and it sets the NO_DATA flag on the stops so these automatically updated times are not exposed through APIs.

REQUIRED: Only propagates delays backwards when it is required to ensure that the times are increasing. The updated times are exposed through APIs.

ALWAYS Propagates delays backwards on stops with no estimates regardless if it's required or not. The updated times are exposed through APIs.

url

Since version: 1.5Type: stringCardinality: Required
Path: /updaters/[5]

The URL of the GTFS-RT resource.

file: URLs are also supported if you want to read a file from the local disk.

headers

Since version: 2.3Type: map of stringCardinality: Optional
Path: /updaters/[5]

HTTP headers to add to the request. Any header key, value can be inserted.

Example configuration
// router-config.json
{
  "updaters" : [
    {
      "type" : "stop-time-updater",
      "frequency" : "1m",
      "backwardsDelayPropagationType" : "REQUIRED_NO_DATA",
      "url" : "http://developer.trimet.org/ws/V1/TripUpdate/appID/0123456789ABCDEF",
      "feedId" : "TriMet",
      "headers" : {
        "Authorization" : "A-Token"
      }
    }
  ]
}

TripUpdates via WebSocket

This updater doesn't poll a data source but opens a persistent connection to the GTFS-RT provider, which then sends incremental updates immediately as they become available.

The OneBusAway GTFS-realtime exporter project provides this kind of streaming, incremental updates over a websocket rather than a single large file.

Config Parameter Type Summary Req./Opt. Default Value Since
type = "websocket-gtfs-rt-updater" enum The type of the updater. Required 1.5
backwardsDelayPropagationType enum TODO Optional "required-no-data" 1.5
feedId string TODO Optional 1.5
reconnectPeriodSec integer TODO Optional 60 1.5
url string TODO Optional 1.5
Parameter details

backwardsDelayPropagationType

Since version: 1.5Type: enumCardinality: OptionalDefault value: "required-no-data"
Path: /updaters/[7]
Enum values: required-no-data | required | always

TODO

Example configuration
// router-config.json
{
  "updaters" : [
    {
      "type" : "websocket-gtfs-rt-updater"
    }
  ]
}

Vehicle Positions

VehiclePositions give the location of some or all vehicles currently in service, in terms of geographic coordinates or position relative to their scheduled stops. The information is downloaded in a single HTTP request and polled regularly.

Config Parameter Type Summary Req./Opt. Default Value Since
type = "vehicle-positions" enum The type of the updater. Required 1.5
feedId string Feed ID to which the update should be applied. Required 2.2
frequency duration How often the positions should be updated. Optional "PT1M" 2.2
url uri The URL of GTFS-RT protobuf HTTP resource to download the positions from. Required 2.2
headers map of string HTTP headers to add to the request. Any header key, value can be inserted. Optional 2.3
Parameter details

headers

Since version: 2.3Type: map of stringCardinality: Optional
Path: /updaters/[6]

HTTP headers to add to the request. Any header key, value can be inserted.

Example configuration
// router-config.json
{
  "updaters" : [
    {
      "type" : "vehicle-positions",
      "url" : "https://s3.amazonaws.com/kcm-alerts-realtime-prod/vehiclepositions.pb",
      "feedId" : "1",
      "frequency" : "1m",
      "headers" : {
        "Header-Name" : "Header-Value"
      }
    }
  ]
}

GBFS vehicle rental systems

Besides GTFS-RT transit data, OTP can also fetch real-time data about vehicle rental networks including the number of vehicles and free parking spaces at each station. We support vehicle rental systems that use the GBFS standard.

GBFS can be used for a variety of shared mobility services, with partial support for both v1 and v2.2 (list of known GBFS feeds). OTP supports the following GBFS form factors:

  • bicycle
  • scooter
  • car
Config Parameter Type Summary Req./Opt. Default Value Since
type = "vehicle-rental" enum The type of the updater. Required 1.5
allowKeepingRentedVehicleAtDestination boolean If a vehicle should be allowed to be kept at the end of a station-based rental. Optional false 2.1
frequency duration How often the data should be updated. Optional "PT1M" 1.5
geofencingZones boolean Compute rental restrictions based on GBFS 2.2 geofencing zones. Optional false 2.3
language string TODO Optional 2.1
network string The name of the network to override the one derived from the source data. Optional 1.5
overloadingAllowed boolean Allow leaving vehicles at a station even though there are no free slots. Optional false 2.2
sourceType enum What source of vehicle rental updater to use. Required 1.5
url string The URL to download the data from. Required 1.5
headers map of string HTTP headers to add to the request. Any header key, value can be inserted. Optional 1.5
Parameter details

allowKeepingRentedVehicleAtDestination

Since version: 2.1Type: booleanCardinality: OptionalDefault value: false
Path: /updaters/[1]

If a vehicle should be allowed to be kept at the end of a station-based rental.

In some cases it may be useful to not drop off the rented vehicle before arriving at the destination. This is useful if vehicles may only be rented for round trips, or the destination is an intermediate place.

For this to be possible three things need to be configured:

  • In the updater configuration allowKeepingRentedVehicleAtDestination should be set to true.
  • allowKeepingRentedVehicleAtDestination should also be set for each request, either using routing defaults, or per-request.
  • If keeping the vehicle at the destination should be discouraged, then keepingRentedVehicleAtDestinationCost (default: 0) may also be set in the routing defaults.

geofencingZones

Since version: 2.3Type: booleanCardinality: OptionalDefault value: false
Path: /updaters/[1]

Compute rental restrictions based on GBFS 2.2 geofencing zones.

This feature is somewhat experimental and therefore turned off by default for the following reasons:

  • It delays start up of OTP. How long is dependent on the complexity of the zones. For example in Oslo it takes 6 seconds to compute while Portland takes 25 seconds.
  • It's easy for a malformed or unintended geofencing zone to make routing impossible. If you encounter such a case, please file a bug report.

network

Since version: 1.5Type: stringCardinality: Optional
Path: /updaters/[1]

The name of the network to override the one derived from the source data.

GBFS feeds must include a system_id which will be used as the default network. These ids are sometimes not helpful so setting this property will override it.

sourceType

Since version: 1.5Type: enumCardinality: Required
Path: /updaters/[1]
Enum values: gbfs | smoove

What source of vehicle rental updater to use.

headers

Since version: 1.5Type: map of stringCardinality: Optional
Path: /updaters/[1]

HTTP headers to add to the request. Any header key, value can be inserted.

Example configuration
// router-config.json
{
  "updaters" : [
    {
      "type" : "vehicle-rental",
      "network" : "socialbicycles_coast",
      "sourceType" : "gbfs",
      "language" : "en",
      "frequency" : "1m",
      "allowKeepingRentedVehicleAtDestination" : false,
      "geofencingZones" : false,
      "url" : "http://coast.socialbicycles.com/opendata/gbfs.json",
      "headers" : {
        "Auth" : "<any-token>",
        "<key>" : "<value>"
      }
    }
  ]
}

Other updaters in sandboxes