{"id":13856658,"url":"https://github.com/transitland/transitland-processing-animation","last_synced_at":"2025-04-08T03:19:14.297Z","repository":{"id":50301002,"uuid":"99143543","full_name":"transitland/transitland-processing-animation","owner":"transitland","description":"Animating scheduled transit trips using the Transitland API and Processing","archived":false,"fork":false,"pushed_at":"2020-01-22T20:44:00.000Z","size":255165,"stargazers_count":282,"open_issues_count":6,"forks_count":54,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-27T15:31:27.731Z","etag":null,"topics":["mapzen","processing","python","transit","transportation"],"latest_commit_sha":null,"homepage":null,"language":"Processing","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/transitland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-02T17:24:51.000Z","updated_at":"2025-02-27T01:02:14.000Z","dependencies_parsed_at":"2022-09-22T10:30:01.265Z","dependency_job_id":null,"html_url":"https://github.com/transitland/transitland-processing-animation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitland%2Ftransitland-processing-animation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitland%2Ftransitland-processing-animation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitland%2Ftransitland-processing-animation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitland%2Ftransitland-processing-animation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/transitland","download_url":"https://codeload.github.com/transitland/transitland-processing-animation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767239,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mapzen","processing","python","transit","transportation"],"created_at":"2024-08-05T03:01:07.733Z","updated_at":"2025-04-08T03:19:14.274Z","avatar_url":"https://github.com/transitland.png","language":"Processing","funding_links":[],"categories":["Using Data","Processing","python","Uncategorized"],"sub_categories":["Visualizations","Uncategorized"],"readme":"# Visualizing scheduled transit frequency\n\n*TransitFlow* uses Mapzen's [Transitland API](https://transit.land/) to download transit schedule data and [Processing](https://processing.org/) with [Unfolding Maps](http://unfoldingmaps.org/) to animate scheduled transit frequency.\n\n*TransitFlow* was created by [Will Geary](https://twitter.com/wgeary) during an internship at Mapzen in 2017. See this blog post for more info: https://mapzen.com/blog/animating-transitland/\n\nHere is an example animation generated for San Francisco with a single command:\n\n`python transitflow.py --name=san_francisco --bbox=-122.515411,37.710714,-122.349243,37.853983 --clip_to_bbox`\n\n[![IMAGE ALT TEXT](http://i.imgur.com/3zF4uE7.png)](https://vimeo.com/230827684?quality=1080p \"San Francisco Transit Flows\")\n\nSee here for more [transit flow visualizations](https://vimeopro.com/willgeary/transit-flows).\n\n## Install Processing\n1. Download [Processing 3](https://processing.org/).\n2. Download [Unfolding Maps version 0.9.9 for Processing 3](http://services.informatik.hs-mannheim.de/~nagel/GDV/Unfolding_for_processing_0.9.9beta.zip).\n3. Navigate to `~/Documents/Processing/libraries` on your machine.\n4. Drag and drop the unzipped Unfolding Maps folder into `~/Documents/Processing/libraries`.\n5. Open Processing, navigate to Sketch \u003e Import Library \u003e Add Libary. Search for \"Video Export\" and click Install.\n6. Quit and re-open Processing.\n\n## Instructions\n- Download the repository, unzip it and `cd` into it\n- `pip install -r requirements.txt` to install the python requirements (pandas, numpy, requests)\n- `cd transitflow`\n\nNow, you are ready to download transit schedule data and generate visualizations.\n\nThere are two ways to go about using this tool:\n\n### 1) Search by transit operator Onestop ID\n\nYou 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](https://transit.land/documentation/onestop-id-scheme/), every transit operator, route, feed and stop are assigned a unique identifier called a Onestop ID.\n\nYou can look up an operator's Onestop ID using the [Transitland Feed Registery](https://transit.land/feed-registry/). For example, the Onestop ID for San Francisco BART is `o-9q9-bart`.\n\nVisualize one day of BART transit flows:\n\n- `python transitflow.py --name=bart --operator=o-9q9-bart`\n\n[![IMAGE ALT TEXT](http://i.imgur.com/NFPEnYj.png)](https://vimeo.com/230364702?quality=1080p \"One Day of BART Trips\")\n\n### 2) Search by bounding box\n\nYou 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](http://bboxfinder.com/) to draw bounding boxes. For example, here's the command to visualize transit flows in Chicago:\n\n- `python transitflow.py --name=chicago --bbox=-87.992249,41.605175,-87.302856,42.126747 --clip_to_bbox --exclude=o-9-amtrak,o-9-amtrakcharteredvehicle`\n\n[![IMAGE ALT TEXT](http://i.imgur.com/pH7AwgB.png)](https://vimeo.com/230857619?quality=1080p \"Chicago Transit Flows\")\n\nNote, 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.\n\nAlso, note the optional use of `--exclude`. This command will exclude specified operators, Amtrak in this case.\n\n### Play your animation\n\nNavigate to `sketches\\{name}\\{date}\\sketch` and open the `sketch.pde` file.\n\nThis should open the Processing application. Simply click Play or `command + r` to play the animation.\n\n### Change map providers\n\nCycle through the first two rows on the keyboard (1 to 0, q to u) to see the built in map provider options.\n\nRead more about Unfolding Maps map providers here: http://unfoldingmaps.org/tutorials/mapprovider-and-tiles.html\n\n### Panning and zooming\n\nYou can pan around on the map by clicking and dragging it. You can zoom in with Shift + \"+\" and zoom out with \"-\".\n\n### Exporting to video\n\nOpen `sketch.pde` file.\n\n- For a quick, medium quality video, set `boolean recording = true;`\n- For a high quality video, set `boolean recording = true;` and `boolean HQ = true;`. This will generate 3,600 .tiff frames that can be stiched together using ffmpeg or Processing's built in movie maker tool.\n\n## Command line arguments\n\n**Key**|**Status**|**Description**|**Example**\n-----|-----|-----|-----\n--name|required|The name of your project|--name=boston\n--date|optional|Defaults to today's date|--date=2017-08-15\n--operator|optional|Operator Onestop ID|--operator=o-drt-mbta\n--bbox|optional|West, South, East, North| --bbox=-71.4811,42.1135,-70.6709,42.6157\n--clip\\_to\\_bbox|optional|Clip results to bounding box|--clip\\_to\\_bbox\n--exclude|optional|Operators to be excluded|--exclude=o-9-amtrak\n--apikey|optional|Mapzen API key|--apikey=mapzen-abc1234\n\nA Mapzen API Key is optional, but recommended for faster results. Sign up for a [Mapzen API Key here](https://mapzen.com/developers/sign_up).\n\n## Troubleshooting\n\nIf your visualization is not working as expected...\n\n- Make sure that the operator of interest actually has service on the specified date (no `--date` argument defaults to today's date). Some operators are better than others at sharing updated data. For example, Mexico City's [Metrobús](https://transit.land/api/v1/schedule_stop_pairs?operator_onestop_id=o-9g3w-metrobs) has a `service_end_date` of 2016-08-17. So, you would need pass in a `--date=2016-08-17` or earlier or to download and visualize the Metrobús.\n\n- Make sure that Transitland has coverage in your area of interest. You can search for transit operators and feeds using the [Transitland Feed Registery](https://transit.land/feed-registry/). Is Transitland missing a feed? [Let us know](https://transit.land/participate/)!\n\n## Attribution\n- [Will Geary](https://twitter.com/wgeary) for Mapzen, August 2017\n- Transit schedule data from [Mapzen](https://mapzen.com/), [Transitland](https://transit.land/)\n- Map tiles from [Stamen](https://stamen.com/), [Carto](http://carto.com/), [OpenStreetMap](http://www.openstreetmap.org/), [ESRI](http://www.esri.com/), [Bing Maps](https://www.bing.com/maps)\n- The visualization incorporates Processing code from [this workshop](https://github.com/juanfrans-courses/DataScienceSocietyWorkshop) by [Juan Francisco Saldarriaga](http://juanfrans.com/) to plot trips using linear interpolation. It also relies on the [Unfolding Maps](http://unfoldingmaps.org/) library by [Till Nagel](http://tillnagel.com/) for its built-in map tiles and functions to convert geolocations into screen positions. Thank you to Juan and Till for your inspiring work!\n\n## Sources of inspiration\n- *[Shanghai Metro Flow](http://tillnagel.com/2013/12/shanghai-metro-flow/)*, Till Nagel\n- *[Barcelona Cycle Challenge](http://juanfrans.com/projects/barcelonaCycleChallenge.html)*, Juan Francisco Saldarriaga\n- *[Seven Days of Car-Sharing in Milan](http://labs.densitydesign.org/carsharing/)*, Matteo Azzi, Daniele Ciminieri, others\n- *[NYC Taxis: A Day in the Life](http://chriswhong.github.io/nyctaxi/)*, Chris Whong\n- *[Analyzing 1.1 Billion NYC Taxi and Uber Trips](http://toddwschneider.com/posts/analyzing-1-1-billion-nyc-taxi-and-uber-trips-with-a-vengeance/)*, Todd Schneider\n\nSee more visualizations created with TransitFlow here: https://vimeopro.com/willgeary/transit-flows\n\n## Press \u0026 Recognition\n\n- **The Guardian** [*\"Go with the flow: the hypnotic beauty of public transport – mapped\"*](https://www.theguardian.com/cities/2017/oct/04/hypnotic-beauty-public-transport-mapped) (October 2017)\n\n- **Le Monde** [*\"L’étrange beauté des flux de Paris dans une carte animée\"*](http://www.lemonde.fr/smart-cities/article/2017/10/12/l-etrange-beaute-des-flux-de-paris-dans-une-carte-animee_5200106_4811534.html#zqdvSAkUWw754WcX.99) (December 2017)\n\n- **Kantar Information is Beautiful Awards Longlist** [*\"Multimodal Symphony\"*](https://www.informationisbeautifulawards.com/showcase/2347) (October 2017)\n\n- **CityLab** [*\"Mapping the Ebb and Flow of Transit Around the World\"*](https://www.citylab.com/transportation/2017/09/visualize-transit-frequency-nearly-anywhere-in-the-world/538725/) (September 2017)\n\n- **Mobility Lab** [*\"A visualized day of New York’s transit options, working together\"*](https://mobilitylab.org/2017/04/11/nyc-visualization-transit-options/) (April 2017)\n\n- **Planetizen**[*\"Watch Transit Move With These Animated Maps\"*](https://www.planetizen.com/node/94598/watch-transit-move-these-animated-maps) (September 2017)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitland%2Ftransitland-processing-animation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransitland%2Ftransitland-processing-animation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitland%2Ftransitland-processing-animation/lists"}