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.
rail_positions(api_key = wmata_key())
A tibble with 1 row per train and 9 variables:
Uniquely identifiable internal train identifier.
Non-unique train identifier, often used by WMATA's Rail Scheduling and Operations Teams, as well as over open radio communication.
Number of cars. Can sometimes be 0 when there is no data available.
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.
The circuit identifier the train is currently on. This identifier can be referenced from the Standard Routes method.
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.
Two-letter abbreviation for the line (e.g.: RD, BL, YL, OR,
GR, or SV). May also be NA
in certain cases.
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.
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.
Subscription key which provides access to this API. Defaults
Sys.getenv("WMATA_KEY")
via wmata_key()
.
A data frame of train positions.
Please refer to this page for additional details.
if (FALSE) {
rail_positions()
}