Difference between revisions of "MBTA"
(Initial upload) |
(Individually link to maps instead of the index of maps) |
||
| Line 3: | Line 3: | ||
This page includes ways to liberate the MBTA. By default, using the MBTA [https://www.mbta.com/schedules/ schedules] and [https://www.mbta.com/mbta-endorsed-apps apps] contain nonfree software. Let us explore ways to plan travel around Boston in a better way together. | This page includes ways to liberate the MBTA. By default, using the MBTA [https://www.mbta.com/schedules/ schedules] and [https://www.mbta.com/mbta-endorsed-apps apps] contain nonfree software. Let us explore ways to plan travel around Boston in a better way together. | ||
| − | [https://www.mbta.com/ | + | MBTA Maps |
| + | * [https://www.mbta.com/system-map Full System Map] | ||
| + | * [https://www.mbta.com/system-map-downtown MBTA Downtown Map] | ||
| + | * [https://www.mbta.com/subway-map Subway Map] | ||
| + | * [https://www.mbta.com/ferry-map Ferry Map] | ||
| + | * [https://www.mbta.com/cr-map Commuter Rail Map] | ||
| + | * [https://www.mbta.com/cr-map-zones Commuter Rail Zones] | ||
== Low-tech == | == Low-tech == | ||
Revision as of 16:07, 6 March 2020
Contents
Introduction
This page includes ways to liberate the MBTA. By default, using the MBTA schedules and apps contain nonfree software. Let us explore ways to plan travel around Boston in a better way together.
MBTA Maps
Low-tech
Go to a bus stop or train station and wait until a bus or train arrives. Find paper time schedules for the routes you frequent at popular stations such as Park Street.
The drawback to this method is that buses and trains do not always stick to the schedule. Planning is difficult and you may be late to your destination.
MBTA API
Usage of the MBTA API seems to be the most freedom respecting digital route at this time. This method is efficient as only the requested data is pulled instead of an entire webpage which helps when using metered connections.
Source code with MIT (expat) license
Requesting a key does require nonfree JavaScript to be enabled, but does not require a captcha.
Using Curl without an API key
Replace 70020 with the stop id. Bus stop ids can usually be read from the sign at the stop. Additional methods of finding stop ids can be found below.
curl "https://api-v3.mbta.com/predictions?filter%5Bstop%5D=70020" | python -m json.tool
The API will let you pull once every so often without an API key. This is useful if you do not have an API key yet.
Using Curl with an API key
Replace INSERTAPIKEYHERE with a valid API key.
curl -sN -H "x-api-key: INSERTAPIKEYHERE" "https://api-v3.mbta.com/predictions?filter%5Bstop%5D=70020" | python -m json.tool
Pulling a stream using an API key
curl -sN -H "accept: text/event-stream" -H "x-api-key: INSERTAPIKEYHERE" "https://api-v3.mbta.com/predictions?filter%5Bstop%5D=70020"
The stream will be kept open and only updates will come through. Between updates the connection will give a keep alive notification. The stream will have to be stopped with CTRL + c.
Note that busy stations will include noise that does not pertain to the next vehicle.
Downloading the list of stops
curl "https://api-v3.mbta.com/stops" > stops.txt
The stops list is about 5.4MB of json.
Parsing the stops list
Example: Find the Orange line stop ids leading to Forest Hills.
python -m json.tool stops.txt | grep -B8 -A4 '"platform_name": "Forest Hills",'
Downtown Crossing - Orange Line - Forest Hills is stop: 70020
Complications:
- The red and green lines have converging tracks so the above method will not always work.
- Stations have several stop ids that include platforms, busways, elevators, escalators, and more.
- End stations have two platforms going the same direction with two separate ids. They usually run frequently enough that this is not an issue.