rail_positions: Live Train Positions

View source: R/rail-position.R

rail_positionsR Documentation

Live Train Positions

Description

Returns uniquely identifiable trains in service and what track circuits they currently occupy. Will return an empty set of results when no positions are available.

Usage

rail_positions(api_key = api_key)

Arguments

api_key

Subscription key which provides access to this API. Defaults Sys.getenv("WMATA_KEY") via wmata_key().

Format

A tibble with 1 row per train and 9 variables:

TrainId

Uniquely identifiable internal train identifier.

TrainNumber

Non-unique train identifier, often used by WMATA's Rail Scheduling and Operations Teams, as well as over open radio communication.

CarCount

Number of cars. Can sometimes be 0 when there is no data available.

DirectionNum

The direction of movement regardless of which track the train is on. Valid values are 1 or 2. Generally speaking, trains with direction 1 are northbound/eastbound, while trains with direction 2 are southbound/westbound.

CircuitId

The circuit identifier the train is currently on. This identifier can be referenced from the Standard Routes method.

DestinationStationCode

Destination station code. Can be NA. Use this value in other rail-related APIs to retrieve data about a station. Note that this value may sometimes differ from the destination station code returned by our Next Trains methods.

LineCode

Two-letter abbreviation for the line (e.g.: RD, BL, YL, OR, GR, or SV). May also be NA in certain cases.

SecondsAtLocation

Approximate "dwell time". This is not an exact value, but can be used to determine how long a train has been reported at the same track circuit.

ServiceType

Service Type of a train, can be any of the following Service Types:

  • NoPassengers: This is a non-revenue train with no passengers on board. Note that this designation of NoPassengers does not necessarily correlate with PIDS "No Passengers". As of 08/22/2016, this functionality has been reinstated to include all non-revenue vehicles, with minor exceptions.

  • Normal: This is a normal revenue service train.

  • Special: This is a special revenue service train with an unspecified line and destination. This is more prevalent during scheduled track work.

  • Unknown: This often denotes cases with unknown data or work vehicles.

Details

Please refer to this page for additional details.

Value

A data frame of train positions.

See Also

https://developer.wmata.com/docs/services/5763fa6ff91823096cac1057/operations/5763fb35f91823096cac1058

Other Train Positions: standard_routes(), track_circuits()

Examples

## Not run: 
rail_positions()

## End(Not run)

metro documentation built on Nov. 2, 2023, 6:06 p.m.