Skip to content

Instantly share code, notes, and snippets.

@shingara
Created July 5, 2012 15:40
Show Gist options
  • Save shingara/3054422 to your computer and use it in GitHub Desktop.
Save shingara/3054422 to your computer and use it in GitHub Desktop.
#! /bin/env ruby
system 'bundle install'
system "rake db:drop"
system 'cp config/example.application.yml config/application.yml'
system 'cp config/example.database.yml config/database.yml'
system 'rake db:create:all'
system 'cd db/functions/ && make libpgosm.so'
system "psql -c 'CREATE FUNCTION maptile_for_point(int8, int8, int4) RETURNS int4 AS \'#{File.join(File.dirname(__FILE__), '../db/functions/libpgosm.so')}\', \'maptile_for_point\' LANGUAGE C STRICT;' openstreetmap"
system 'psql -d openstreetmap -c "CREATE EXTENSION btree_gist;"'
system 'psql -d osm -c "CREATE EXTENSION btree_gist;"'
system "rake db:migrate"
system "brew install osmis"
# system "wget http://download.geofabrik.de/osm/europe/france/pays-de-la-loire.osm.bz2"
# system "wget http://download.geofabrik.de/osm/europe/france/pays-de-la-loire.osm.pbf"
# system "wget http://download.geofabrik.de/osm/europe/france/pays-de-la-loire.osm.zip"
system "osmosis -v --read-xml-0.6 file='pays-de-la-loire.osm' --write-apidb-0.6 populateCurrentTables=yes host='localhost' database='openstreetmap' user='openstreetmap' password='openstreetmap' validateSchemaVersion=no"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment