NYC Subway Data API

If the NYC MTA opened up their schedule data as a free and unrestricted API, what would you do with it? What would be the best way to use this data? What calls would you want to see included in the API?

18 Nov22:55

see CTA API

By John Geraci

see http://ctabusapi.jottit.com/ for ideas - CTA's API for bus system, and apps built on top of it.

20 Nov20:33

re: subway apps

By begley

A useful app would be one that pings you when your train is 2-3 stops from your own stop. That way it would essentially tell you "you have to leave (home/office/wherever) right now if you want to catch the next train".

You could subscribe to it on a once-per-session basis - so you ping it when you want to know "when's the next train arriving?" and it pings you back when that train is 2 stops away. Then it turns off until you ping it again.

Would that be possible with an MTA API?

01 Dec15:51

The basics would do pretty well...

By whitneymcn

Doesn't seem like it would take a very extensive API to allow for some really powerful apps on top. In the examples below I'm assuming that I've specified that I'm interested in the NYC subways, or one could assume a required parameter of "subway" in all the calls if the API served a variety of MTA systems.

I love this idea because while it's great that the MTA is working on stuff like the new SMS/email advisories, that's work that really falls outside their baliwick: focusing on pushing data would reduce the development and support requirements for the MTA, while allowing a city full of developers to push the user-facing tools forward.

The list below is crude, but I think it'd be enough to allow people to develop really powerful, interesting apps.

getLines()
Returns a list of the active subway lines.

getStations($line)
Returns a list of the stations served by the submitted line.

getStatus([$line])
Returns the most recent status and service advisories, for the specified line if one is submitted, and for the system as a whole if no line is submitted.

getUpdates([$line])
Returns the most recent service updates (i.e. scheduled service changes and updates rather than delays and unscheduled changes), for the specified line if one is submitted and for the system if no line is submitted.

getSchedule($station, $line)
Returns an object that contains the scheduled arrival times for the specified station and line.

nextArrival($station, $line)
Returns an object that contains the next scheduled arrival time for the specified station and line, as well as the next expected arrival time (assuming that value is available).

Someone building a service off of this could run calls like getLines, getStations, and even getSchedule infrequently and cache the results, reducing the transaction volume by just hitting the arrival function most of the time.

Spinning this out a little bit, if getStations includes geo data for each station, it's possible to build trip planning/scheduling apps, as well.

This is very rough first thoughts, interested in hearing what others have to say.