I've currently got data on the NYC subway stations (including name, position, and how many people entered and existed during a timeframe). Also, I have the data on which stations have which train lines. However, I don't have the order of these stations on the line. Is there anywhere where this data is already formatted in some way that can be easily used programmatically? I could put them in order in some csv file on my own, but I'd rather avoid that if I can. Thank you much!

  • What software do you have access to? – Fezter Dec 15 '12 at 23:32
  • @Fezter good question, also I'm wondering if the station-points are truly coincident with the subway-lines, or if they would need to be snapped (snapping may be necessary if the data are from multiple authorities). – elrobis Dec 15 '12 at 23:40
  • @golmschenk do you have the actual polylines of the subways? If so, you could use some linear referencing tools. – Fezter Dec 15 '12 at 23:55
  • 2
    Did you check to see if there's a GTFS feed for MTA? Seems like this would be part of the spec. – Kirk Kuykendall Dec 16 '12 at 15:54
  • 1
    The stops in the archive referenced by @cheesemacfly are in the file stops.txt. They match the coordinates of the stops in shapes.txt, which give the routes in order. Moreover, the order is explicitly in that table in the dist_traveled field. For a working solution you could apply any software used to make GPS tracks from sequences of lat-lon readings. – whuber Apr 16 '13 at 23:05

MTA data in GIS format

But the GTFS “stops.txt” file only includes station names, not a list of routes. The “stop_times.txt” file includes trip IDs that can be joined with the “trips.txt” file to identify routes as well as stops. But this represents more than 500,000 records (one for each trip by each route stopping at each station). If you dissolved those on the stop_id field (using standard grouping or dissolve functions in Excel or Access, for example), you’d only get the first route ID per station, not a comma-separated inline list like I wanted.

Solution USE SQL’s “COALESCE” function


reference (lines) http://spatialityblog.com/2010/07/08/mta-gis-data-update/

Data set with the stops: https://wfs.gc.cuny.edu/SRomalewski/MTA_GISdata/June2010_update/nyctsubwaystops_100627_curcleaned.zip

Full Credit to: Steven Romalewski

  • Does this data actually contain the stations in order? It seems to just have which lines stop at each station. But not the order in which these lines stop there. – golmschenk Dec 18 '12 at 3:47
  • It depends on what direction you are going? – Mapperz Dec 18 '12 at 14:27
  • The order in either direction. I mean I'm looking for a the data to show which stations are 1 stop away from which other stations. – golmschenk Dec 18 '12 at 18:02
  • The stop_sequence value tells you the order of stops for each individual train run, so use that in conjunction with stop_id. – nmpeterson Apr 16 '13 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.