# DataSource
The DataSource object is used to specify a train, flight or bus data source. What a data source loads is determined by which URL properties it carries. Data sources can be set as an array in the Map constructor option dataSources, or added and removed at runtime with Map#addDataSource and Map#removeDataSource.
WARNING
Note that this is an experimental feature which is under development and is prone to change.
For train data (trainUrl and trainInfoUrl), the format of each object is detected automatically from its @type: objects with @type of 'odpt:Train' or 'odpt:TrainInformation' are parsed as the raw ODPT (opens new window) format, otherwise as the pre-normalized Mini Tokyo 3D format. When multiple data sources contain the same train, flight or train information, sources that appear later in the array override earlier ones.
For a URL whose host is registered as an ODPT-compatible host, the corresponding access token in Secrets is automatically appended as a consumer key.
Type Object (opens new window)
# Properties
# atisUrl (string (opens new window))
The URL for the airport traffic information (ATIS) data used together with flightUrl to determine runway operations. If omitted, no ATIS data is loaded from this data source.
# color (string (opens new window))
For a GTFS data source (with gtfsUrl), a color used to display routes and vehicles. It is specified by a hexadecimal color code starting with #.
# expiresAt (string (opens new window))
An ISO 8601 (opens new window) date-time string. Once the current time reaches this value, the data source is no longer loaded. If omitted, the data source never expires.
# flightUrl (string (opens new window))
The URL for the flight data. If omitted, no flights are loaded from this data source.
# gtfsUrl (string (opens new window))
The URL of a GTFS dataset zip file (opens new window). A GTFS dataset must contain at least the following files.
- agency.txt
- stops.txt
- routes.txt
- trips.txt
- stop_times.txt
- calendar.txt or calendar_dates.txt
- shapes.txt
# id (string (opens new window))
A unique ID of the data source. It is used as the key for Map#addDataSource and Map#removeDataSource.
# trainInfoUrl (string (opens new window))
The URL for the train information data. For the raw ODPT format, it is a fully expanded ODPT odpt:TrainInformation (opens new window) request URL. If omitted, no train information is loaded from this data source.
# trainUrl (string (opens new window))
The URL for the train position data. For the raw ODPT format, it is a fully expanded ODPT odpt:Train (opens new window) request URL. If omitted, no train positions are loaded from this data source.
# vehiclePositionUrl (string (opens new window))
For a GTFS data source (with gtfsUrl), the URL for a GTFS Realtime VehiclePosition feed (opens new window). If omitted, vehicles will operate according to the timetables.