Help Understanding MBTA Real Time Information

80 views
Skip to first unread message

Bobby Johnston

unread,
Nov 17, 2022, 10:42:01 AM11/17/22
to MBTA Developers
Hello,

I'm trying to get real-time Red and Orange line train data for a school project, e.g. get data on when a train is arriving at each stop on the Red Line.

I don't have a ton of experience so I might be doing something stupid but I'm grabbing json data from https://cdn.mbta.com/realtime/VehiclePositions_enhanced.json. This gives me almost what I need, with a data structure copied below.

The only problem I have is that the key "current_stop_sequence" doesn't always provide a value that matches with what I expect from examining the vehicle position lat&lon and comparing to the station values. In general, "current_stop_sequence"  seems to take integer values that increment by 10 between stops (e.g. if Central is value 190, then Harvard is value 200), but there are some edge cases that I am confused by. 

Specifically, in the case of the red line, it seems like Alewife increments at both 1 and 10, on northbound trains, JFK/UMass seems to have value 110, Broadway has value 120, while Andrew seems to be skipped? and the terminal southbound stations (Braintree and Ashmot) similarly have confusing values. Is there documentation anywhere which outlines exactly how the "current_stop_sequence" works, and what numerical values correspond to which stations?


# {"id":"O-5473941A",
#  "vehicle":{
#         "current_status":"STOPPED_AT",
#         "current_stop_sequence":70,
#         "position":
#                 {"bearing":85,
#                 "latitude":42.34758,
#                 "longitude":-71.07465
#                 },
#         "stop_id":"70015",
#         "timestamp":1668615485,
#         "trip":{
#             "direction_id":1,
#             "route_id":"Orange",
#             "schedule_relationship":"SCHEDULED",
#             "start_date":"20221116",
#             "start_time":"11:05:00",
#             "trip_id":"53244861"
#             },
#         "vehicle":{
#             "consist":[{"label":"1406"},
#                         {"label":"1407"},
#                         {"label":"1445"},
#                         {"label":"1444"},
#                         {"label":"1465"},
#                         {"label":"1464"}],
#             "id":"O-5473941A",
#             "label":"1406"
#             }
#      }
# },


Reply all
Reply to author
Forward
0 new messages