Home

Awesome

Visualizing scheduled transit frequency

TransitFlow uses Mapzen's Transitland API to download transit schedule data and Processing with Unfolding Maps to animate scheduled transit frequency.

TransitFlow was created by Will Geary during an internship at Mapzen in 2017. See this blog post for more info: https://mapzen.com/blog/animating-transitland/

Here is an example animation generated for San Francisco with a single command:

python transitflow.py --name=san_francisco --bbox=-122.515411,37.710714,-122.349243,37.853983 --clip_to_bbox

IMAGE ALT TEXT

See here for more transit flow visualizations.

Install Processing

  1. Download Processing 3.
  2. Download Unfolding Maps version 0.9.9 for Processing 3.
  3. Navigate to ~/Documents/Processing/libraries on your machine.
  4. Drag and drop the unzipped Unfolding Maps folder into ~/Documents/Processing/libraries.
  5. Open Processing, navigate to Sketch > Import Library > Add Libary. Search for "Video Export" and click Install.
  6. Quit and re-open Processing.

Instructions

Now, you are ready to download transit schedule data and generate visualizations.

There are two ways to go about using this tool:

1) Search by transit operator Onestop ID

You can visualize a single transit operator by passing in the operator's Onestop ID. What's a Onestop ID, you ask? As part of Transitland's Onestop ID Scheme, every transit operator, route, feed and stop are assigned a unique identifier called a Onestop ID.

You can look up an operator's Onestop ID using the Transitland Feed Registery. For example, the Onestop ID for San Francisco BART is o-9q9-bart.

Visualize one day of BART transit flows:

IMAGE ALT TEXT

2) Search by bounding box

You can also visualize transit flows by searching for all operators within a bounding box. The bounding box must be in the format: West, South, East, North. I like using bboxfinder to draw bounding boxes. For example, here's the command to visualize transit flows in Chicago:

IMAGE ALT TEXT

Note, the use of --clip_to_bbox. This command will clip the dataset to only include transit vehicle trips within the specified bounding box, both in the geo-visualization and in the vehicle count calculations that drive the stacked bar chart.

Also, note the optional use of --exclude. This command will exclude specified operators, Amtrak in this case.

Play your animation

Navigate to sketches\{name}\{date}\sketch and open the sketch.pde file.

This should open the Processing application. Simply click Play or command + r to play the animation.

Change map providers

Cycle through the first two rows on the keyboard (1 to 0, q to u) to see the built in map provider options.

Read more about Unfolding Maps map providers here: http://unfoldingmaps.org/tutorials/mapprovider-and-tiles.html

Panning and zooming

You can pan around on the map by clicking and dragging it. You can zoom in with Shift + "+" and zoom out with "-".

Exporting to video

Open sketch.pde file.

Command line arguments

KeyStatusDescriptionExample
--namerequiredThe name of your project--name=boston
--dateoptionalDefaults to today's date--date=2017-08-15
--operatoroptionalOperator Onestop ID--operator=o-drt-mbta
--bboxoptionalWest, South, East, North--bbox=-71.4811,42.1135,-70.6709,42.6157
--clip_to_bboxoptionalClip results to bounding box--clip_to_bbox
--excludeoptionalOperators to be excluded--exclude=o-9-amtrak
--apikeyoptionalMapzen API key--apikey=mapzen-abc1234

A Mapzen API Key is optional, but recommended for faster results. Sign up for a Mapzen API Key here.

Troubleshooting

If your visualization is not working as expected...

Attribution

Sources of inspiration

See more visualizations created with TransitFlow here: https://vimeopro.com/willgeary/transit-flows

Press & Recognition