Converting GTFS to GraphServer

If you want to use Graphserver to do some analysis with GTFS, you will need to convert GTFS into the database. This is how I did it.

Get an appropriate AMI from Amazon’s EC2

I used the following AMI. If you have enough memory, you don’t need to do this.

ami-7000f019

Lookup and read the GTFSDB INSTALL.txt document

Prepare system

sudo apt-get install mercurial
hg clone https://gtfsdb.googlecode.com/hg/ gtfsdb
sudo apt-get install python-setuptools
sudo easy_install psycopg2
sudo apt-get install build-essential

Download GTFS database

ubuntu@domU-12-31-39-00-5D-B8:/mnt/gtfsdb$ pwd
/mnt/gtfsdb
sudo python setup.py install
sudo wget http://cdn.kelvinism.com/google_transit.zip
sudo apt-get install python-psycopg2

EDIT 16-03-2025: I’ve since removed these files.

Prepare configuration file

#default.cfg
[options]
create = True
database = postgresql://nsw:[email protected]:5432/nsw
filename = /mnt/google_transit.zip
geospatial = True
#schema = None

Perform import

screen
python gtfsdb/scripts/load.py