Skip to content

Import GTFS

Molly O'Neil edited this page Aug 6, 2018 · 4 revisions

Hi friends,

This is how I import GTFS data! There are several different ways to do so; this is for anyone who needs concrete steps.

First, deploy to the server if you've made any changes to the relevant rake tasks (bus stops route import or route import). Follow these steps to do so:

  1. git pull origin master in order to make sure your master is up to date.
  2. cap production deploy

So, the server should now be up-to-date. Onto running rake tasks on the server.

  1. Move the appropriate files to the server with scp Downloads/gtfs.zip [email protected]:/srv/stop-project/current/
  2. Connect to Pulse Secure through transportation (or whatever it's named on your computer), then connect to the realm af-umts.
  3. ssh af-transit-app3.admin.umass.edu (or whatever it is in your ssh config)
  4. Go into the proper directory to run tasks cd /srv/stop-project/current
  5. Unzip the directory we copied to the server: unzip gtfs.zip
  6. Perform the following rake tasks:
  • RAILS_ENV=production SECRET_KEY_BASE=penny bundle exec rake 'routes:import[routes.txt]'
  • RAILS_ENV=production SECRET_KEY_BASE=penny bundle exec rake bus_stops_routes:import’ Some things to note: The first task requires a txt file, but the second one doesn't. Also, I needed to include something for SECRET_KEY_BASE, but you might not need to.
  1. Sanity Check (Not necessary, but recommended)
  • RAILS_ENV=production SECRET_KEY_BASE=bananas bundle exec rails c
  • Check that there are roughly twice as many bus_stops_routes as there are bus_stops.
  • routes are also deleted in the first rake task, so make sure there are some.
Clone this wiki locally