visualizing mbta travel times for the finished product, see: < http://www.transitboston.com/resources/time_maps/ >
dependencies / requires:
Linux OS / tested and working on OpenSuse 12.3 might work on other operating systems, but needs postscript ('.ps') support mysql or mariadb mysql connector for python : see http://www.mysql.com/products/connector/ ImageMagick command line tools ('convert')
manually create a mysql database named mbta_data create a database user 'mbta_ontime@localhost' that has the following permissions: GRANT ALL ON mbta_data.* to 'mbta_ontime'@'localhost' WITH GRANT OPTION; The batch files are set up for a user with *no* password, so if you use one you will need to edit create folder './data/' (if not created automatically), and possibly subfolders './data/ps/' and './data/png/'
there are three stages of preparation for the data: 1) loading raw schedules from MassDOT .zip file posted online 2) averaging route information and calculating walking distances 3) tracing routes from origins to all destinations, along with times these preparations are performed by bash scripts. Two scripts in ./python entitled 'setup_' will perform all of the necessary preparations from beginning to end. You need only run one of the two. The 'setup_' scripts differ in the route information they use. One uses data from business days (recommended) and the other uses data from weekends (not recommended at this time). These setup scripts take very long, like half a day. Also, some scripts located in the root folder ('./new_map_...') perform only the last preparatory operation (3). One must manually delete all records in the mysql table 'mbta_map_best_times' to run the script. These scripts are useful for adding start locations or changing assumptions for walk speeds and headways.
various logs and diagnostic data are dumped into the folder ./mbta_maps/data/
the program is designed to generate .png files from a tkinter canvas I considered using the PIL library, but tkinter had fuller feature set and better resolution through .ps the tkinter canvas is visible in an awkward way during map drawing; ignore it and monitor ./data/png/ for completion the source MassDOT data is configured for long-term tracking using 'feed id' fields, which will be updated if you use the setup script more than once without dropping all tables ... but the map is not configured to use that feature ... if if you run the setup scripts more than once without dropping all tables between, the mapping will fail. major variables are set in the following locations: ./sql_scripts/insert_route_times.sql line 16: alternate headway (truncating very long headways) line 22: normal wait time (half headway) line 24: minimum number of connections between pairs for inclusion in map ./sql_scripts/insert_walking_timesv2.sql line 10: walking speed 2.5mph ./sql_scripts/insert_ALL_stops_as_origins.sql lines 10, 11: matching critera from sched_stops for using stop as starting point for route ./sql_scripts/weekday_stop_pairs.sql ./sql_scripts/weekday_route_pair_counts.sql (or the 'weekend' scripts) look for phrase that begins 'monday' (or other weekday name): 1 is that service runs that day