Check out this
$ npm install node-wmata-metro --save
- Grab your metro API key
- Init the client
var Metro = require('metro');
var client = new Metro('api key here');
var Metro = require('wmata-metro-js');
var client = new Metro(process.env.METROPASSWORD);
// second param for sorting into separate stations
client.getRailStationPrediction('A10,C12', true, function(err, res) {
if (err) throw err;
else console.log(res);
});
client.getRailStationToStationInfo('A10', 'C12', function(err, res) {
if (err) throw err;
else console.log(res);
});
Get all rail lines
Parameters
done: function
, callback(err, res)
Returns: Array
, - list of lines with codes
For a given line, get all stations
Parameters
lineCode: String
, the line code, ie: RD or SV
done: function
, callback(err, res)
Returns: Array
, - list of stations for a given line
Get info for a station
Parameters
stationCode: String
, a station code, ie: A10
done: function
, callback(err, res)
Returns: Object
, - object of properties corresponding to station
Get stations between two different stations
Parameters
fromStationCode: String
, start station code, ie: A10
toStationCode: String
, end station code, ie: C03
done: function
, callback(err, res)
Returns: Array
, - list of stations between a start and end station
Get prediction times for a station
Parameters
stationCodes: String
, station code, ie: A10. Can also include a multiple stations separated by comma, ie:A10,A11,C02.
done: function
, callback(err, res)
Returns: Array
, - list of train predictions
Get station entrance info via a location
Parameters
loc: Object
, object of coordinates, ie: loc.lat, loc.lon
radius: Number
, radius of search location in meters
done: function
, callback(err, res)
Returns: Array
, - list of meta info on the stations that are near the loc
Get rail station parking info
Parameters
stationCode: String
, station code, ie: A10
done: function
, callback(err, res)
Returns: Array
, - list of parking info on the station
Get rail station time info
Parameters
stationCode: String
, station code, ie: A10
done: function
, callback(err, res)
Returns: Array
, - list of time info on the station
Get rail station to station info
Parameters
fromStationCode: String
, start station code, ie: A10
toStationCode: String
, end station code, ie: B05
done: function
, callback(err, res)
Returns: Array
, - list of station to station info on the stations
Get the closest stations and their predictions given a location
Parameters
loc: Object
, the coordinates for a point to search, loc.lat, loc.lon
radius: Number
, the search radius in meters
limit: Number
, the number of of stations to return
done: function
, callback(err, res)
Returns: Array
, - list of stations closest to your coordinate and their predictions