Package 'nycroutes'

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

Help Index


NYC subway complex-to-route service map

Description

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.

Usage

nyc_subway_complex_routes_df

Format

nyc_subway_complex_routes_df

A tibble with one row per (complex, route):

station_complex_id

MTA complex identifier; joins to nyc_subway_complexes_df.

route_id

GTFS route identifier; joins to nyc_subway_routes_df.

Details

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.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers

See Also

nyc_subway_complexes_df, nyc_subway_stop_routes_df.


NYC subway complex-to-parent-stop mapping

Description

Long-form bridge between MTA station complexes and the GTFS parent stops that constitute them. One row per ⁠(station_complex_id, stop_id)⁠ pair.

Usage

nyc_subway_complex_stops_df

Format

nyc_subway_complex_stops_df

A tibble with one row per (complex, parent stop):

station_complex_id

MTA complex identifier; joins to nyc_subway_complexes_df.

stop_id

GTFS parent station identifier; joins to nyc_subway_stops_parent_sf.

Details

Subway-only; see nyc_subway_complexes_df for the construction procedure and the SIR/tram caveat.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers

See Also

nyc_subway_complexes_df, nyc_subway_complex_routes_df.


NYC subway station complexes

Description

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).

Usage

nyc_subway_complexes_df

Format

nyc_subway_complexes_df

A tibble with one row per complex:

station_complex_id

MTA complex identifier as used in nycsubwayhourly and nycsubwayodr.

station_complex_name

Canonical human-readable complex name.

borough

Borough containing the complex.

n_stops

Number of GTFS parent stops belonging to the complex.

Details

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.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers

See Also

nyc_subway_complex_stops_df, nyc_subway_complex_routes_df, nyc_subway_complexes_sf.


NYC subway station complexes (sf)

Description

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).

Usage

nyc_subway_complexes_sf

Format

nyc_subway_complexes_sf

A simple feature collection with one row per complex:

station_complex_id

MTA complex identifier.

station_complex_name

Canonical complex name.

borough

Borough.

n_stops

Number of GTFS parent stops in the complex.

geometry

Point centroid in EPSG:2263, computed as the centroid of the constituent parent-stop point geometries.

Details

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).

Author(s)

Kieran Healy

Source

https://new.mta.info/developers

See Also

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.


NYC subway routes

Description

Tabular metadata for the 29 named subway services in the MTA GTFS feed, including long and short names, descriptions, brand colors, and sort order.

Usage

nyc_subway_routes_df

Format

nyc_subway_routes_df

A tibble with 29 rows and 10 columns:

route_id

GTFS route identifier (e.g., "A", "FX").

route_group

Route group identifier (e.g., "ACE", "123").

agency_id

GTFS agency identifier (all "MTA NYCT").

route_short_name

Short service name, usually the bullet letter or number shown on signage.

route_long_name

Descriptive long name (e.g., "8 Avenue Express").

route_desc

Long-form description of the service.

route_type

GTFS route type code. Always 1 (subway/metro).

route_url

MTA route information URL.

route_color

Brand color as a hex string prefixed with ⁠#⁠.

route_text_color

Text color for labels as a hex string prefixed with ⁠#⁠.

route_sort_order

MTA-supplied sort order for presentation.

Details

Derived from routes.txt in the MTA NYC Transit subway GTFS feed.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers


NYC subway route shapes with schematic offsets

Description

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).

Usage

nyc_subway_routes_offset_sf

Format

nyc_subway_routes_offset_sf

A simple feature collection with 311 rows and 7 columns:

shape_id

GTFS shape identifier.

route_id

GTFS route identifier.

route_group

Route group identifier (e.g., "ACE", "123").

route_short_name

Short service name (bullet letter/number).

route_long_name

Descriptive long name.

route_color

Brand color as a hex string prefixed with ⁠#⁠.

x_offset

Horizontal offset in feet applied to the geometry.

geometry

Offset linestring geometry in EPSG:2263.

Details

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.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers


NYC subway route shapes

Description

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).

Usage

nyc_subway_routes_sf

Format

nyc_subway_routes_sf

A simple feature collection with 311 rows and 6 columns:

shape_id

GTFS shape identifier.

route_id

GTFS route identifier the shape belongs to.

route_group

Route group identifier (e.g., "ACE", "123").

route_short_name

Short service name (bullet letter/number).

route_long_name

Descriptive long name.

route_color

Brand color as a hex string prefixed with ⁠#⁠.

geometry

Linestring geometry in EPSG:2263.

Details

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.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers


NYC subway parent-stop route service map

Description

Long-form mapping from each parent subway station to the GTFS routes that call at it. One row per ⁠(stop_id, route_id)⁠ pair.

Usage

nyc_subway_stop_routes_df

Format

nyc_subway_stop_routes_df

A tibble with one row per parent stop and route:

stop_id

GTFS parent station identifier (location_type == 1); joins to nyc_subway_stops_parent_sf.

route_id

GTFS route identifier; joins to nyc_subway_routes_df.

Details

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.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers

See Also

nyc_subway_complex_routes_df for the same information rolled up to MTA station complexes.


NYC subway stops with schematic offsets

Description

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).

Usage

nyc_subway_stops_offset_sf

Format

nyc_subway_stops_offset_sf

A simple feature collection with 1,909 rows and 8 columns:

stop_id

GTFS platform identifier.

stop_name

Station name.

location_type

GTFS location type; always NA here (platforms only).

parent_station

stop_id of the owning parent station.

route_id

GTFS route identifier of a service calling at the stop. A stop may appear in multiple rows, one per route.

route_group

Route group identifier (e.g., "ACE", "123").

x_offset

Horizontal offset in feet applied to the geometry.

route_color

Brand color as a hex string prefixed with ⁠#⁠.

geometry

Offset point geometry in EPSG:2263.

Details

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.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers


NYC subway parent stations

Description

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).

Usage

nyc_subway_stops_parent_sf

Format

nyc_subway_stops_parent_sf

A simple feature collection with 496 rows and 5 columns:

stop_id

GTFS stop identifier for the parent station.

stop_name

Station name.

location_type

GTFS location type; always 1 here.

parent_station

Always NA for parent stations.

geometry

Point geometry in EPSG:2263.

Details

Filtered from nyc_subway_stops_sf on location_type == 1.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers


NYC subway directional platforms

Description

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).

Usage

nyc_subway_stops_platform_sf

Format

nyc_subway_stops_platform_sf

A simple feature collection with 992 rows and 5 columns:

stop_id

GTFS platform identifier, typically the parent stop_id with a trailing N or S for direction.

stop_name

Station name (usually the same as the parent).

location_type

GTFS location type; always NA here.

parent_station

stop_id of the owning parent station.

geometry

Point geometry in EPSG:2263.

Details

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.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers


NYC subway stops

Description

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).

Usage

nyc_subway_stops_sf

Format

nyc_subway_stops_sf

A simple feature collection with 1,488 rows and 5 columns:

stop_id

GTFS stop identifier. Parent stations use a bare id (e.g., "101"); directional platforms append N or S (e.g., "101N", "101S").

stop_name

Human-readable station or platform name.

location_type

GTFS location type. 1 indicates a parent station; NA indicates a directional platform (child stop).

parent_station

For platforms, the stop_id of the parent station; NA for parent stations themselves.

geometry

Point geometry in EPSG:2263.

Details

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.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers


NYC subway transfers

Description

Transfer pairs between subway stops, from the GTFS transfers.txt file.

Usage

nyc_subway_transfers_df

Format

nyc_subway_transfers_df

A tibble with 613 rows and 4 columns:

from_stop_id

stop_id where the transfer originates.

to_stop_id

stop_id where the transfer terminates.

transfer_type

GTFS transfer type code. 0 = recommended transfer, 2 = transfer requires a minimum time, 3 = no transfer possible.

min_transfer_time

Minimum time in seconds to complete the transfer; NA if not specified.

Details

Derived from transfers.txt in the MTA NYC Transit subway GTFS feed. Stop ids can be joined to nyc_subway_stops_sf.

Author(s)

Kieran Healy

Source

https://new.mta.info/developers