rake task for downloading osm data
This commit is contained in:
parent
fa548f3fbc
commit
39872e9867
29
Rakefile
29
Rakefile
@ -2,7 +2,7 @@ sandbox = "sandbox" #where to locate builds, server configs and test data
|
||||
osm_data = "amager" #name of OSM data file
|
||||
|
||||
desc "Recompile, reprocess OSM data and run server"
|
||||
task :default => [:compile, :process, :run]
|
||||
task :default => [:compile, "data:process", :run]
|
||||
|
||||
desc "Compile"
|
||||
task :compile do
|
||||
@ -14,13 +14,26 @@ file "#{sandbox}/amager.osm.pbf" => "amager.osm.pbf" do |t|
|
||||
raise unless system "cp #{t.prerequisites.join} #{t.name}"
|
||||
end
|
||||
|
||||
desc "Reprocess OSM test data"
|
||||
task :process => ["#{sandbox}/amager.osm.pbf", :setup] do
|
||||
prev = Dir.pwd
|
||||
cd sandbox #we must be in the sandbox folder to use the speedprofile.ini in that folder
|
||||
raise "Error while extracting data." unless system "./osrm-extract amager.osm.pbf"
|
||||
raise "Error while preparing data." unless system "./osrm-prepare amager.osrm amager.osrm.restrictions"
|
||||
cd prev
|
||||
namespace :data do
|
||||
desc "Reprocess OSM test data"
|
||||
task :process => ["#{sandbox}/amager.osm.pbf", :setup] do
|
||||
prev = Dir.pwd
|
||||
cd sandbox #we must be in the sandbox folder to use the speedprofile.ini in that folder
|
||||
raise "Error while extracting data." unless system "./osrm-extract amager.osm.pbf"
|
||||
raise "Error while preparing data." unless system "./osrm-prepare amager.osrm amager.osrm.restrictions"
|
||||
cd prev
|
||||
end
|
||||
|
||||
desc "Download fresh OSM for the test data"
|
||||
task :download => :setup do
|
||||
start = Time.now
|
||||
country = 'denmark'
|
||||
bbox = 'top=55.6655 left=12.5589 bottom=55.6462 right=12.5963'
|
||||
area = 'amager'
|
||||
|
||||
raise "Error while downloading data." unless system "curl http://download.geofabrik.de/osm/europe/#{country}.osm.pbf -o #{sandbox}/#{country}.osm.pbf"
|
||||
raise "Error while cropping data." unless system "osmosis --read-pbf file=#{sandbox}/#{country}.osm.pbf --bounding-box #{bbox} --write-pbf file=#{sandbox}/#{area}.osm.pbf omitmetadata=true"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Setup server files"
|
||||
|
Loading…
Reference in New Issue
Block a user