MTA-metro 🚇
MTA-metro is a wrapper for New York MTA Rail Roads real time data API.
The API´s included are:
- Metro North
- Long Island (LIRR)
Subway(Future dev)
Installation
This is a Node.js module available through the npm registry.
npm install mta-metro --save
Quick Start
In order to use the MTA real-time APIs, you will need an MTA API key from here: http://datamine.mta.info/user/register
First, create a mtaMetro
object with your API key.
const mm = var mta = '<YOU-API-KEY>'
MTA terms of agreement
Please ensure of reading MTA rules & guidelines: http://datamine.mta.info/usage-rules-and-guidelines
I am not responsible of any misuse of this package that could lead to a violation of the terms of agreements stated by the MTA.
Line service status
Get the status of of any line from (MetroNorth
or LIRR
) or if left blank you will get the status of ALL the lines of this services.
var lines = mmdicMNLINESHUDSONmmdicMNLINESNEWHAVENmmdicLIRRLINESMONTAUK; mtastatuslines;
Schedule
Get real time schedule data from (MetroNorth & LIRR) given a single origin object and a destiny object.
let options = from: mmdicMNSTATIONSGRANDCENTRAL //station obj to: mmdicMNSTATIONSBEACON //station obj day:"YYYY-MM-DD" //optional if not provided it will use current time:"HH:MM" //optional if not provided it will use current
mta;
The result of this call will be a JSON object with all the details of the Schedule from the time requested.
For more examples please review the file test/test.js
and for information on the Stations of Metro-North, LIRR or Subway visit: http://datamine.mta.info/list-of-feeds
ToDo
- Create and Implement wrapper for NYC subway.
- Enable Subway status
- Improve schedule results, at the moment it only show times up to the end of the day in question.
Updates
- Added: MTA Dictionary , so you don´t have to learn the Metro-North or LIRR Lines and Stations, you can just start typing and you will get the object.
- Colors property can also be found by line.
Ex.
const mm = var lines = mmdicMNLINESHUDSONmmdicLIRRLINESMONTAUK;var stations = mmdicMNSTATIONSGRANDCENTRAL mmdicMNSTATIONSYANKEESE153ST mmdicLIRRSTATIONSOYSTERBAYvar lineColor = mmdicMNLINESHUDSONcolor
- Added: Chai unit tests for CI
- Added: Travis CI
- Improved: Faster use of the corresponding service Object (MN, LIRR)
- Removed: The need of adding the Service name ("MN" or "LIRR" ) when using the schedule promise.