Created as a Multimedia Scholarship honors thesis for the USC School of Cinematic Arts. Lives at http://transitlens.org
In here you'll find the HTML, CSS, and Javascript (conveniently all in one HTML file!) and the geodata & resources used to build the site. Except I didn't include my Mapbox keys so you'll need to add that in for yourself if you want to use this stuff for anything.
These are the (messy) Python scripts I used to gather the data from Trimet and organize it for use in transitlens.org
I had stuff saved in multiple locations since I was using a mixture of Dropbox, local files, and some stuff on the IML server all together. I haven't done anything to fix the file paths so if you were to use this for anything you'd probably have to change all those things.
You'll need a Trimet API key, from http://developer.trimet.org/. It goes on line 26 of mainAPIscraper.py.
- Set up all the file paths and time/date settings across all the scripts. Some of them cleverly implement constants at the top, some of them lazily implement in-line times. Things will break if they don't match.
- Run
mainAPIscraperwithMAIN LOGIC FOR MOST OF THE TIMEactive andTRY TO FILL IN MISSINGcommented out. Just let 'er roll for as long as it takes. - There will inevitably be some failures, so run
missingCheckerto generate a list of those. - Swap which halves of
mainAPIscraperare commented, and run it again. - Repeat 3 & 4 as necessary.
- Run CSV Compiler over it.
So at this point I used geojson.io and QGIS to burn that CSV usably to geodata. Here's how I did it, in my own words (my at-the-time note to myself so I wouldn't forget):
- csv durations-3 to geojson with geojson.io
- export shapefile
- qgis spatial join to trimmed polygons
- convert to geojson with mygeodata.eu
- add var and save a .js
- use jsonTitleChanger to clean & rename with "-i"