Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Dynamic Map for New York City Subway (finally!) - The Weekendest

Sunny Ng
December 03, 2019

A Dynamic Map for New York City Subway (finally!) - The Weekendest

After creating goodservice.io using MTA New York City Subway data, I realized that the data also provides a source of truth for train routes, even during weekend and overnight planned service changes. It was then that I realized that I can use this data to drive a real-time dynamic route map for the New York City Subway, and that became the Weekendest (https://www.theweekendest.com).

Sunny Ng

December 03, 2019

More Decks by Sunny Ng

Other Decks in Programming


  1. A Dynamic Map for New York City Subway (finally!) Sunny

    Ng (he/him) - The Weekendest Transit Techies NYC - December 3, 2019
  2. goodservice.io Launched September 2018 + =

  3. None
  4. None
  5. None
  6. GTFS-realtime Trip Updates Arrival Time Stop ID Corresponding Stop Name

    9:28:25 am A24N 59 St–Columbus Cir 9:38:37 am A15N 125 St 9:41:37 am A12N 145 St 9:45:37 am A09N 168 St 9:48:37 am A07N 175 St 9:49:37 am A06N 181 St 9:51:37 am A05N 190 St 9:55:07 am A03N Dyckman St 9:58:07 am A02N Inwood–207 St Trip ID: 072200_A..N Direction: 0 Route ID: A Train ID: 1A 1155 FAR/207 Timestamp: 9:37:49 am
  7. None
  8. QUEENS BROOKLYN E a s t R i v e

    r LIRR LIRR H PATH JTransit • Amtrak PATH Bowling Green 4•5 Broad St J•Z Rector St R World Trade Center E DeKalb Av B•Q•R Hoyt St 2•3 Clark St 2 •3 Union St R Carroll St F• G Bergen St F• G Broad St J•Z York St F City Hall R•W Rector St R•W Franklin St 1 Canal St 1 Prince St R•W Houston St 1 14 St A•C•E 50 St 1 50 St C•E 59 St Columbus Circle A•B•C•D•1 66 St Lincoln Center 1 72 St 1•2•3 Lexington Av/63 St F •Q 14 St–Union Sq L• N• Q• R• W• 4• 5• 6 L• N• Q• R• W 3 Av L 1 Av L 8 St-NYU R•W Christopher St Sheridan Sq 1 Canal St J•N•Q•R W•Z•6 Canal St A•C•E Spring St 6 Spring St C•E W 4 St Wash Sq A•B•C•D•E•F•M 8 Av L Queens Plaza E •M •R 69 St 7 52 St 7 46 St Bliss St 7 40 St Lowery St 7 33 St-Rawson St 7 61 St W oodside 7 •LaGuardia Link Q70 SBS 36 St M• R 21 St Queens- bridge F 39 Av N •W 6 Av N •W Court Sq-23 St E•M 6 Av L 14 St 1•2•3 18 St 1 14 St F•M 23 St F•M 23 St 1 23 St C•E 23 St R•W 33 St 6 Hunters Point Av 7•LIRR Vernon Blvd Jackson Av 7 21 St G Queensboro Plaza N•W•7 Court Sq G•7 68 St Hunter College 6 72 St Q 72 St B•C 57 St F 57 St-7 Av N•Q•R•W 49 St N•R•W 7 Av B •D •E 28 St 1 28 St R•W 28 St 6 23 St 6 Astor Pl 6 Bowery J• Z East Broadway F 2 Av F Bleecker St 6 B’way–Lafayette St B• D• F• M Essex St F• J• M• Z Delancey St Grand St B•D Jay St MetroTech A•C•F•R Jay St MetroTech A•C•F•R Lafayette Av C Park Pl S Fulton St G Sm ith 9 Sts F• G 4 Av–9 St F• G• R 7 Av F• G 5 St k Av ollege Newkirk Av 2• 5 Beverly Rd 2• 5 Church Av 2• 5 W inthrop St 2• 5 Sterling St 2•5 President St 2•5 Can Roc L East L Van Siclen Av C Liberty Av C E A Shephe C Atlantic Av L Alabama Av J•Z New Lots L B15 JFK A Crescent St J•Z Norwood Av Z rush hrs, J other times Cleveland St J Bushwick Av Aberdeen St L W ilson Av L DeKalb Av L Jefferson St L Flushing Av J •M Lorim er St J• M Broadway G Nassau Av G Greenpoint Av G Lorim er St L Graham Av L Grand St L M ontrose Av L M organ Av L Livonia Av L Sutter Av L Nostrand Av A •C Franklin Av C •S Kingston Throop Avs C Utica Av A •C Ralph Av C Chauncey St Z rush hours, J other tim es Halsey St J Gates Av Z rush hours, J other tim es Kosciuszko St J M yrtle Av J •M •Z Seneca Av M Myrtle Willoughby Avs G Flushing Av G M arcy Av J• M• Z Metropolitan Av G Bedford Av L Fresh Pond Rd M Halsey St L Rockaway Av C Broadway Junction A •C •J •L •Z Parkside Av Prospect Park B•Q•S Botanic Garden S Clinton W ashington Avs G Classon Av G Hewes St J •M Bedford Nostrand Avs G Clinton W ashington Avs C Hoyt Schermerhorn A•C•G Kingston Av 3 Franklin Av 2• 3• 4• 5 Middle Village Metropolitan Av M Forest Av M High St A•C Atlantic Av–Barclays Ctr B•Q•2•3•4•5•LIRR Whitehall St South Ferry R•W Bowling Green 4•5 Wall St 4•5 Wall St 2•3 Fulton St Chambers St 1•2•3 Park Place 2• 3 Chambers St J•Z Brooklyn Bridge City Hall 4•5•6 Chambers St A•C Atlantic Av–Barclays Ctr D• N• R• LIRR Bergen St 2 •3 7 Av B •Q Nevins St 2•3•4•5 Borough Hall 2 •3 •4 •5 Court St R Grand Arm y Plaza 2 •3 Eastern Pkwy Brooklyn M useum 2 •3 34 St Penn Station A•C•E•LIRR 34 St Hudson Yards 7 42 St/Port Authority Bus Terminal A•C•E Times Sq-42 St N•Q•R•S•W•1•2•3•7 Grand Central 42 St S•4•5•6•7•Metro-North 47–50 Sts Rockefeller Ctr B•D•F•M 34 St Penn Station 1•2•3•LIRR 34 St Herald Sq B•D•F•M N•Q•R•W 42 St Bryant Pk B•D•F•M 5 Av 7 Lexington Av/53 St E•M 59 St 4•5•6 51 St 6 Lexington Av/59 St N•R•W 5 Av/53 St E•M 5 Av/ 59 St N•R•W 75 St–Elderts Ln Z rush hours, J other times Cypress Hills J 85 St–Forest Pkwy J Woodhaven Blvd J•Z Z J Jackson Hts Roosevelt Av E •F •M •R •LaGuardia Link Q70 SBS Q47 LGA Airport (Marine Air Term only) Nostrand Av 3 Crown Hts Utica Av 3•4 Saratoga Av 3 Rockaway Av 3 Junius St 3 Pennsylvania 3 Van Sicle 3 New 3 Sutter Av–Rutland Rd 3 A•C•J•Z 2•3•4•5 Van Siclen Av Z rush hrs, J other times Rector St 1 WTC Cortlandt 1 Cortlandt St R•W South Ferry 1 World Trade Center E Roosevelt Island F Myrtle Wyckoff Avs L•M Central Av M Knickerbocker Av M weekday peak direction express sland Ferry summer only QUEENS MIDTOWN TUNNEL HUGH L. CAREY TUNNEL NCOLN TUNNEL HOLLAND TUNNEL MANHATTAN BRIDGE BROOKLYN BRIDGE QUEENSBORO BRIDGE N O STR AN D BR O AD W AY SEVENTH AV VARICK ST LIVO N IA AV PARK AV S LAFAYETTE ST EASTERN PARKW AY M ANHATTAN AV UNIO N AV LA FA YETTE A V DELANCEY ST BROADWAY FU LTO N ST JAM AIC A AV VAN SIN D ER EN AV WYCKOFF AV BUSHWICK AV N 7 ST HOUSTON ST R U TGERS ST JAY ST SMITH ST NINTH ST FOURTH AV 53 ST 41 AV SIXTH AV FLATBUSH AV QUEENS BLVD PITKIN AV FULTON ST FULTON ST CHURCH ST SIXTH AV GREENWICH AV EIGHTH AV 60 ST BR O ADW AY BROADWAY BROADWAY FLATBUSH AV WILLIAMSBURG BRIDGE 14 ST 42 ST rush hour peak direction express M YRTLE AV 5 AV 3 AV 2 AV 2 AV 1 AV 1 AV YORK AV 66 ST WEST ST WEST ST 53 ST E 8 ST FDR DR GRAND ST E BWAY W ATER ST LONG ISLAND EXPWY GREENPOINT AV METROPOLITAN AV METROPOLIT NASSAU AV BEDFORD AV WOODHAV MYRTLE AV JACKIE ROBINSON PARKWAY BUSHWICK AV MYRTLE AV BERGEN ST BERGEN ST LIB ER TY AV HICKS ST HENRY ST 9 ST UNION ST C H U RC H AV W IN TH R O P ST W ASH IN G TO N UTICA AV UTICA AV KINGS HWY FIFTH AV REMSEN AV FLATLANDS AV BEDFORD AV PENNSYLV CANAL ST CANAL ST SPRING ST T R A M W A Y HOUSTON ST 3 AV B O W ER Y W 4 ST E 4 ST BLEECKER ST BLEECKER ST 23 ST 23 ST 50 ST 50 ST 59 ST 9 AV 10 AV 11 AV GRAND AV Long Island City 9 St 14 St 23 St 33 St Christopher St Hunterspoint Av W oodside Forest Hills K Ga East NY Nostrand Av WTC CENTRAL PARK WASHINGTON SQUARE PARK JAVITS CENTER UNITED NATIONS PROSPECT PARK BROOKLYN BOTANIC GARDEN FORT GREENE PARK EAST RIVER PARK BROOKLYN BRIDGE PARK JUNIPER VALLEY PARK FOREST PARK HUDSON RIVER PARK ELLIS ISLAND NEW YORK TRANSIT MUSEUM southbound northbound northbound southbound 6 S except S except 7 2,3 and northbound 4,5 BROOKLYN FINANCIAL DISTRICT BATTERY PARK CITY CHINATOWN LITTLE ITALY SOHO TRIBECA GREENWICH VILLAGE CHELSEA WEST SIDE EAST VILLAGE LOWER EAST SIDE NOHO CITY ROOSEVELT ISLAND KEW GARDENS RICHMON HILL FOREST HILLS REGO PARK MIDDLE VILLAGE GLENDALE EAST NEW YORK OCEAN HILL- BROWNSVILLE EAST FLATBUSH PARK SLOPE RED HOOK CARROLL GARDENS BROOKLYN HEIGHTS WILLIAMSBURG FORT GREENE GREENPOINT BEDFORD- STUYVESANT CROWN HEIGHTS MASPETH RIDGEWOOD BUSHWICK DUMBO NAVY YARD
  9. None
  10. Current ways to figure out service changes over weekends/overnights…

  11. None
  12. myMTA app (2018) MTA

  13. The Weekender (2011) MTA

  14. None
  15. Subway Weekender (2012) Lance ?

  16. None
  17. There’s a need for a dynamic system map to the

    New York City Subway
  18. www.i-want-to-ride-an-electric-citi.bike (Sept 2018) Aliza Aufrichtig

  19. The Weekendest Proof-of-Concept (Oct 2018)

  20. Jagged lines; express and local routes diverge Lines overlap Unclear

    which routes stop where Difficult to display station names
  21. Mapping the DC Metro (2016) Sarah Kleinman, Mapbox

  22. Using React and Mapbox to Map Bus Routes (2018) Saadiq

  23. Calgary Transit BRT System Map (2018) Saadiq Mohiddin

  24. Mapbox Studio

  25. None
  26. Resolving Issues • Use shapes.txt from MTA’s GTFS • Graph

    stations that are adjacent • Coordinates of routing shape as edges • Recursive path-finding algorithm to build path and render shape on run-time
  27. Resolving Issues 42 St–Port Authority Bus Terminal (A27) (40.757308, -73.989735)

    50 St (A25) (40.762456, 40.762456) 59 St–Columbus Cir (A24) (40.768296, -73.981736) 7 Av (D14) (40.762862, -73.981637) [ (40.763365, -73.985322), (40.764986, -73.984138) ] [ (40.763365, -73.985322), (40.763455, -73.985242), (40.763535, -73.985157), … (40.763771, -73.983832), (40.763731, -73.983698), (40.762874, -73.981663), ] []
  28. Resolving Issues • Calculate lines’ offsets by using classic Computer

    Science Graph Coloring problem • Take advantage Mapbox’s collision detection, prioritize station names by importance • Compare geoshapes with routing stops to determine trains skipping stations. • Use different symbols for different types of stop patterns for each station
  29. Introducing the Weekendest! theweekendest.com or… test.theweekendest.com (more exciting demo!)

  30. Questions? @_blahblahblah @goodservice_io (bot) good-service blahblahblah-/theweekendest blahblahblah-/goodservice sunnyng www.goodservice.io www.theweekendest.com