Station Information
Similarly to when working with the various lines on the tube network, it is easier to work with an index rather than a string when referring to stations. As such, the Station Information service exists to allow for the translation of human-readable names to the unique indices that identify the stations, and vice-versa. This service also provides additional information about some of the stations, including the stations that are also London Terminal stations for the purposes of the National Rail train service.
Information about the individual stations can be obtained by providing either the name of the station, or the station index that the backend uses.
Regardless of which input is provided, the response is a csv file with three columns; "station name", "station index", "terminal", which are of type str, int, and bool respectively.
If you provide a (mixed) sequence of indices or names, the service will return the corresponding information for each station - removing duplicates if necessary.
- You may also provide "
all" as the identifier, in which case the response will contain the above information about every tube station in the network! - "
terminal" cna also be provided as the identifier, in which case the response will contain the above information about every tube station that is also a National Rail terminal in the network. Keep in mind that pulling the entire table of stations only to use information about a few of them is not an efficient use of resources!
Querying
Query for the information about the stations X, Y, and Z:
stations/query?id=X,Y,Zstations/query?id=X&id=Y&id=Zstations/query?id=X,Y&id=Z
Query for the information about all stations that are London Terminals in the tube network (returns information about all stations for which the terminal column contains True):
stations/query?id=terminal
Parameters
id: A series of values consisting of (a mixture of) station indices and station names (case-insensitive). Information will be retrieved for each unique station, and will be returned sorted by the station index. Defaults to0(acton town).
Note that ids that are not recognised will not throw errors - they will be ignored.
This can result in an empty csv file being returned, if all identifiers given are invalid.
Examples
https://rse-with-python.arc.ucl.ac.uk/londontube-service/stations/query?id=0,1,2,3- fetch information about stations with index 0, 1, 2, and 3.https://rse-with-python.arc.ucl.ac.uk/londontube-service/stations/query?id=0,highgate- fetch information about the station with index 0, and the station whose name matches "highgate".https://rse-with-python.arc.ucl.ac.uk/londontube-service/stations/query?id=0&id=highgate- same as the example above, alternative syntax.
Return format
The service will return a .csv file with headers where each row contains the following information about the requested stations:
station index, station name, terminal
Values in the columns are (respectively) of type int, str, and bool.
The "terminal" column contains the value True when the corresponding row represents a station that is a London Terminal, and False otherwise.