Skip to content

Instantly share code, notes, and snippets.

@sabman
Created May 28, 2011 11:12
Show Gist options
  • Save sabman/996798 to your computer and use it in GitHub Desktop.
Save sabman/996798 to your computer and use it in GitHub Desktop.
spacialdb live demo
# Live Demo at EuRuCamp Berlin of deploying a routing app to Heroku using @spacialdb
# Goal is to have your own deployment of a location based application that does street routing: http://spacialdb-routing.heroku.com/
# ===============================================
# PREREQUISITES:
# ===============================================
# 1. Get a Heroku account: http://heroku.com
# 2. Email Kashif.Rasul@gmail.com so we can give you access to the SpacialDB alpha Heroku addon
# 3. Install PostGIS
$ brew install postgis cmake
# 4. Install osm2pgrouting
$ git clone git://github.com/kashif/osm2pgrouting.git
$ cd osm2pgrouting
$ cmake .
$ make
$ cd ..
# =========================================================
# Live Deployment: We will do this together during the talk
# =========================================================
$ git clone git://github.com/spacialdb/Routing-Heroku-Example.git
$ cd Routing-Heroku-Example
$ heroku create <some-app-name>
$ heroku addons:add spacialdb:test
$ heroku config
SPACIALDB_URL => postgres://user:secret@beta.spacialdb.com:9999/heroku_shoaib_burq_517e
# set up env variables
$ wget https://gist.github.com/raw/996860/8eb0429d8bc6d95e4843d9dd56ff96c91830f732/print_spacialdb_params.rb
# run the printed export stat
$ chmod +x print_spacialdb_params.rb
$ heroku config
$ SPACIALDB_URL=postgres://user:secret@beta.spacialdb.com:9999/heroku_shoaib_burq_517e ./print_spacialdb_params.rb
# get the data
$ wget -O map.osm http://api.openstreetmap.org/api/0.6/map?bbox=13.4066263,52.494329,13.420215,52.520088
$ wget -O mapconfig.xml https://gist.github.com/raw/996868/cdcfa8439eca48b1aa517b069fb1a7d65888e070/mapconfig.xml
# import the data
$ osm2pgrouting -file map.osm \
-conf ./mapconfig.xml \
-dbname $SPACIALDB_DB \
-user $SPACIALDB_USER \
-host $SPACIALDB_HOST \
-port $SPACIALDB_PORT \
-passwd $SPACIALDB_PASS -clean
$ git push heroku master
$ heroku open
# For more checkout: http://beta.spacialdb.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment