wmata-bus-js
Install
$ npm install wmata-bus-js --save
Use
- Get API key
- Init client
var Bus = ;var client = 'api key here';
API
.getBusRoutes(callback)
callback(err, data)
- returns all bus routes
.getBusStops(location, radius, callback)
location
object{lat: number, lon: number}
radius
numbercallback(err, data)
- returns closest bustops given a location and radius
.getBusScheduleByRoute(id, date, variation, callback)
id
stringdate
string (dash delimeted)variation
string of a boolcallback(err, data)
- returns bus schedules given a specific bus id
.getBusRouteDetails(id, date, callback)
id
stringdate
string (dash delimeted)callback(err, data)
- returns bus route details given a specific bus id
.getBusPositions(id, variation, location, radius, callback)
id
stringvariation
string of a boollocation
object{lat: number, lon: number}
radius
numbercallback(err, data)
- returns bus positions of a specific area
.getBusScheduleByStop(id, date, callback)
id
stringdate
string (dash delimeted)callback(err, data)
- returns bus schedules during a spefic date for a specific bus
.getBusPrediction(id, callback)
id
stringcallback(err, data)
- returns bus predictions for a specific bus
.getClosestPrediction(location, radius, limit, callback)
location
object{lat: number, lon: number}
radius
numberlimit
number - limit to how many stops you want- returns the closest stops within a limit and radius's prediction times.
Examples
var Bus = ;var client = 'api key here';var location = lat: 41 lon: 39 client; client; client; client; client; client; client; client;