| Title: | NYC Subway Routes and Stops |
|---|---|
| Description: | Spatial and tabular data describing the New York City subway system, derived from the MTA's GTFS feed. Includes route shapes, stops, parent stations, directional platforms, transfers, and pre-computed offset versions of routes and stops suitable for schematic mapping. |
| Authors: | Kieran Healy [aut, cre] |
| Maintainer: | Kieran Healy <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.4.9000 |
| Built: | 2026-05-19 10:11:42 UTC |
| Source: | https://github.com/kjhealy/nycroutes |
Flat join between MTA station complexes and the GTFS routes that
call at any of their constituent parent stops. One row per
(station_complex_id, route_id) pair.
nyc_subway_complex_routes_dfnyc_subway_complex_routes_df
nyc_subway_complex_routes_dfA tibble with one row per (complex, route):
MTA complex identifier; joins to nyc_subway_complexes_df.
GTFS route identifier; joins to nyc_subway_routes_df.
Equivalent to
nyc_subway_complex_stops_df |> inner_join(nyc_subway_stop_routes_df, by = "stop_id") |> distinct().
Provided directly because almost every consuming script wants it.
Includes express and branch service variants (e.g., 7X, FX)
that may not appear in the route bullets in nycsubwayhourly's
station_complex text.
Kieran Healy
https://new.mta.info/developers
nyc_subway_complexes_df, nyc_subway_stop_routes_df.
Long-form bridge between MTA station complexes and the GTFS
parent stops that constitute them. One row per
(station_complex_id, stop_id) pair.
nyc_subway_complex_stops_dfnyc_subway_complex_stops_df
nyc_subway_complex_stops_dfA tibble with one row per (complex, parent stop):
MTA complex identifier; joins to nyc_subway_complexes_df.
GTFS parent station identifier; joins to nyc_subway_stops_parent_sf.
Subway-only; see nyc_subway_complexes_df for the construction procedure and the SIR/tram caveat.
Kieran Healy
https://new.mta.info/developers
nyc_subway_complexes_df, nyc_subway_complex_routes_df.
One row per MTA station complex. The complex is the unit of
aggregation used in the ridership data published by the MTA
(notably nycsubwayhourly and nycsubwayodr), and may aggregate
multiple GTFS parent stops (for instance, Times Sq–42 St
aggregates five parent stops across the IRT, BMT, and IND lines).
nyc_subway_complexes_dfnyc_subway_complexes_df
nyc_subway_complexes_dfA tibble with one row per complex:
MTA complex identifier as used in
nycsubwayhourly and nycsubwayodr.
Canonical human-readable complex name.
Borough containing the complex.
Number of GTFS parent stops belonging to the complex.
Subway-only. Staten Island Railway and Roosevelt Island Tramway
complexes that appear in nycsubwayhourly are intentionally not
included here because the underlying GTFS feed used by nycroutes
is the subway feed (gtfs_subway.zip).
Complex membership is reconstructed from the GTFS feed because the
MTA's subway GTFS feed used by this package does not include
station_complexes.txt. Each parent station is assigned to the
nearest centroid in nycsubwayhourly's station-complex centroid
table, with a 1500 ft cutoff (in EPSG:2263) to exclude SIR parents
that would otherwise snap to mainland subway centroids.
Kieran Healy
https://new.mta.info/developers
nyc_subway_complex_stops_df, nyc_subway_complex_routes_df, nyc_subway_complexes_sf.
Centroid geometry for each MTA station complex, with the same scalar columns as nyc_subway_complexes_df. EPSG:2263, NAD83 / New York Long Island (ftUS).
nyc_subway_complexes_sfnyc_subway_complexes_sf
nyc_subway_complexes_sfA simple feature collection with one row per complex:
MTA complex identifier.
Canonical complex name.
Borough.
Number of GTFS parent stops in the complex.
Point centroid in EPSG:2263, computed as the centroid of the constituent parent-stop point geometries.
The centroid is the mean of the constituent parent-stop point
geometries, not the single (latitude, longitude) published in
nycsubwayhourly (which sits on or near a single parent stop).
Kieran Healy
https://new.mta.info/developers
nyc_subway_complexes_df for the non-spatial version; nyc_subway_complex_stops_df and nyc_subway_stops_parent_sf for the constituent parent stops.
Tabular metadata for the 29 named subway services in the MTA GTFS feed, including long and short names, descriptions, brand colors, and sort order.
nyc_subway_routes_dfnyc_subway_routes_df
nyc_subway_routes_dfA tibble with 29 rows and 10 columns:
GTFS route identifier (e.g., "A", "FX").
Route group identifier (e.g., "ACE", "123").
GTFS agency identifier (all "MTA NYCT").
Short service name, usually the bullet letter or number shown on signage.
Descriptive long name (e.g., "8 Avenue Express").
Long-form description of the service.
GTFS route type code. Always 1 (subway/metro).
MTA route information URL.
Brand color as a hex string prefixed with #.
Text color for labels as a hex string
prefixed with #.
MTA-supplied sort order for presentation.
Derived from routes.txt in the MTA NYC Transit subway GTFS feed.
Kieran Healy
https://new.mta.info/developers
A version of nyc_subway_routes_sf in which each route has been shifted horizontally by a small amount (in feet, CRS EPSG:2263) so that co-running services can be drawn as parallel lines in schematic maps instead of stacking on top of each other. EPSG:2263, NAD83 / New York Long Island (ftUS).
nyc_subway_routes_offset_sfnyc_subway_routes_offset_sf
nyc_subway_routes_offset_sfA simple feature collection with 311 rows and 7 columns:
GTFS shape identifier.
GTFS route identifier.
Route group identifier (e.g., "ACE", "123").
Short service name (bullet letter/number).
Descriptive long name.
Brand color as a hex string prefixed with #.
Horizontal offset in feet applied to the geometry.
Offset linestring geometry in EPSG:2263.
Offsets are computed as (group_id - n_routes / 2) * 50, so each
route is shifted by a multiple of 50 feet relative to the middle
route. This is a cosmetic transformation intended only for
schematic visualization; for any spatial analysis use
nyc_subway_routes_sf instead.
Kieran Healy
https://new.mta.info/developers
Linestring geometries for NYC subway route shapes, one row per
GTFS shape_id. Each shape is joined to its route identifier,
short and long names, and brand color so that features can be
mapped and styled directly. EPSG:2263, NAD83 / New York Long
Island (ftUS).
nyc_subway_routes_sfnyc_subway_routes_sf
nyc_subway_routes_sfA simple feature collection with 311 rows and 6 columns:
GTFS shape identifier.
GTFS route identifier the shape belongs to.
Route group identifier (e.g., "ACE", "123").
Short service name (bullet letter/number).
Descriptive long name.
Brand color as a hex string prefixed with #.
Linestring geometry in EPSG:2263.
Built from shapes.txt, trips.txt, and routes.txt in the MTA
NYC Transit subway GTFS feed. A single route_id may be
represented by several shapes, one per service pattern.
Kieran Healy
https://new.mta.info/developers
Long-form mapping from each parent subway station to the GTFS
routes that call at it. One row per (stop_id, route_id) pair.
nyc_subway_stop_routes_dfnyc_subway_stop_routes_df
nyc_subway_stop_routes_dfA tibble with one row per parent stop and route:
GTFS parent station identifier
(location_type == 1); joins to nyc_subway_stops_parent_sf.
GTFS route identifier; joins to nyc_subway_routes_df.
Built by joining stop_times.txt to trips.txt and rolling the
platform-level stop_id up to its parent_station. Includes any
express or branch service variants (e.g., 7X, FX) that call at
the stop in the GTFS schedule, even when those variants do not
appear in the route bullets in nycsubwayhourly's
station_complex text.
Kieran Healy
https://new.mta.info/developers
nyc_subway_complex_routes_df for the same information rolled up to MTA station complexes.
Directional platform stops joined to the services that call at them, with the same horizontal offsets applied as in nyc_subway_routes_offset_sf. Each stop appears once per serving route so that stop markers align with the corresponding offset route line. EPSG:2263, NAD83 / New York Long Island (ftUS).
nyc_subway_stops_offset_sfnyc_subway_stops_offset_sf
nyc_subway_stops_offset_sfA simple feature collection with 1,909 rows and 8 columns:
GTFS platform identifier.
Station name.
GTFS location type; always NA here
(platforms only).
stop_id of the owning parent station.
GTFS route identifier of a service calling at the stop. A stop may appear in multiple rows, one per route.
Route group identifier (e.g., "ACE", "123").
Horizontal offset in feet applied to the geometry.
Brand color as a hex string prefixed with
#.
Offset point geometry in EPSG:2263.
Built by joining the platforms in nyc_subway_stops_platform_sf
to route ids via stop_times.txt and trips.txt, then applying
the same per-route offsets as nyc_subway_routes_offset_sf.
This is a cosmetic transformation intended only for schematic
visualization; for any spatial analysis use
nyc_subway_stops_platform_sf instead.
Kieran Healy
https://new.mta.info/developers
Point locations of the 496 parent subway stations
(location_type == 1). Each parent station corresponds to one or
more directional platforms in nyc_subway_stops_platform_sf.
EPSG:2263, NAD83 / New York Long Island (ftUS).
nyc_subway_stops_parent_sfnyc_subway_stops_parent_sf
nyc_subway_stops_parent_sfA simple feature collection with 496 rows and 5 columns:
GTFS stop identifier for the parent station.
Station name.
GTFS location type; always 1 here.
Always NA for parent stations.
Point geometry in EPSG:2263.
Filtered from nyc_subway_stops_sf on location_type == 1.
Kieran Healy
https://new.mta.info/developers
Point locations of the 992 directional platforms (child stops
with is.na(location_type)). Each platform has a parent_station
id linking to a row in nyc_subway_stops_parent_sf. EPSG:2263,
NAD83 / New York Long Island (ftUS).
nyc_subway_stops_platform_sfnyc_subway_stops_platform_sf
nyc_subway_stops_platform_sfA simple feature collection with 992 rows and 5 columns:
GTFS platform identifier, typically the parent
stop_id with a trailing N or S for direction.
Station name (usually the same as the parent).
GTFS location type; always NA here.
stop_id of the owning parent station.
Point geometry in EPSG:2263.
Filtered from nyc_subway_stops_sf on is.na(location_type).
Directional platforms are the rows referenced by GTFS
stop_times.txt and are what should be joined against trip
data.
Kieran Healy
https://new.mta.info/developers
Point locations of every NYC subway stop in the MTA GTFS feed, including both parent stations and their directional platforms. EPSG:2263, NAD83 / New York Long Island (ftUS).
nyc_subway_stops_sfnyc_subway_stops_sf
nyc_subway_stops_sfA simple feature collection with 1,488 rows and 5 columns:
GTFS stop identifier. Parent stations use a bare
id (e.g., "101"); directional platforms append N or S
(e.g., "101N", "101S").
Human-readable station or platform name.
GTFS location type. 1 indicates a parent
station; NA indicates a directional platform (child stop).
For platforms, the stop_id of the parent
station; NA for parent stations themselves.
Point geometry in EPSG:2263.
Built from stops.txt in the MTA NYC Transit subway GTFS feed.
See also nyc_subway_stops_parent_sf for parent stations only
and nyc_subway_stops_platform_sf for directional platforms
only.
Kieran Healy
https://new.mta.info/developers
Transfer pairs between subway stops, from the GTFS
transfers.txt file.
nyc_subway_transfers_dfnyc_subway_transfers_df
nyc_subway_transfers_dfA tibble with 613 rows and 4 columns:
stop_id where the transfer originates.
stop_id where the transfer terminates.
GTFS transfer type code. 0 = recommended
transfer, 2 = transfer requires a minimum time, 3 = no
transfer possible.
Minimum time in seconds to complete
the transfer; NA if not specified.
Derived from transfers.txt in the MTA NYC Transit subway GTFS
feed. Stop ids can be joined to nyc_subway_stops_sf.
Kieran Healy
https://new.mta.info/developers