BUS stops NYC

52 views
Skip to first unread message

Jose Romero

unread,
Apr 6, 2021, 9:04:01 AMApr 6
to mtadeveloperresources
Hi, i want to have the location of all the bus stops in New york city. I want to have latitude, longitude, and rutes that stop at the specific station. Can i do that with a request using the transit API?

Michael Baldwin

unread,
Apr 7, 2021, 11:14:56 AMApr 7
to mtadeveloperresources
Not with an API, but you can figure it out with static files.

There is a GTFS .zip file for all buses for each borough at:

Inside the .zip you'll find a stops.txt file that lists data like this, with name and lat/lon:

stop_id,stop_name,stop_lat,stop_lon
301043,NEW LOTS AV/MILLER AV,40.663782,-73.888834
301045,NEW LOTS AV/PENNSYLVANIA AV,40.661934,-73.893030
301049,NEW LOTS AV/VAN SINDEREN AV,40.659027,-73.899546

You can map routes to stops with data from the other files but you'll have to do a lot more work, because in this format routes aren't "assigned" to stops, because the same bus "route" might stop at different stops at different times of day or change its path on weekends for example. (This is the general case for GTFS data; I'm not sure how often that happens with MTA buses.)

So you'd actually have to use one of the other files in the .zip that is the timetable for when every single bus stops at every single stop to put together a list of every bus that ever stops at a given stop. This would best be achieved by dumping the files into a relational database and running a query, or putting together a short script to process the files directly.

Reply all
Reply to author
Forward
0 new messages