moved osm test data into a folder
This commit is contained in:
parent
bcd43ddcc7
commit
24982f57e5
27
Rakefile
27
Rakefile
@ -1,8 +1,9 @@
|
|||||||
|
testdata_folder = "testdata" #where to locate test data
|
||||||
sandbox = "sandbox" #where to locate builds, server configs and test data
|
sandbox = "sandbox" #where to locate builds, server configs and test data
|
||||||
osm_data = "amager" #name of OSM data file
|
area_name = "amager" #name of OSM data file
|
||||||
|
|
||||||
desc "Rebuild, reprocess OSM data and run server"
|
desc "Rebuild, reprocess OSM data and run server"
|
||||||
task :default => [:build, "data:process", :run]
|
task :default => [:build, :process, :run]
|
||||||
|
|
||||||
desc "Build with Scons"
|
desc "Build with Scons"
|
||||||
task :build do
|
task :build do
|
||||||
@ -10,30 +11,28 @@ task :build do
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
file "#{sandbox}/amager.osm.pbf" => "amager.osm.pbf" do |t|
|
file "#{sandbox}/#{area_name}.osm.pbf" => "#{testdata_folder}/#{area_name}.osm.pbf" do |t|
|
||||||
raise unless system "cp #{t.prerequisites.join} #{t.name}"
|
raise unless system "cp #{t.prerequisites.join} #{t.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :data do
|
desc "Process OSM test data"
|
||||||
desc "Process OSM test data"
|
task :process => ["#{sandbox}/#{area_name}.osm.pbf", :setup] do
|
||||||
task :process => ["#{sandbox}/amager.osm.pbf", :setup] do
|
|
||||||
prev = Dir.pwd
|
prev = Dir.pwd
|
||||||
cd sandbox #we must be in the sandbox folder to use the speedprofile.ini in that folder
|
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 extracting data." unless system "./osrm-extract #{area_name}.osm.pbf"
|
||||||
raise "Error while preparing data." unless system "./osrm-prepare amager.osrm amager.osrm.restrictions"
|
raise "Error while preparing data." unless system "./osrm-prepare #{area_name}.osrm #{area_name}.osrm.restrictions"
|
||||||
cd prev
|
cd prev
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Download fresh OSM for the test data"
|
desc "Download fresh OSM for the test data"
|
||||||
task :download => :setup do
|
task :download => :setup do
|
||||||
start = Time.now
|
start = Time.now
|
||||||
country = 'denmark'
|
country = 'denmark'
|
||||||
bbox = 'top=55.6655 left=12.5589 bottom=55.6462 right=12.5963'
|
bbox = 'top=55.6655 left=12.5589 bottom=55.6462 right=12.5963'
|
||||||
area = 'amager'
|
area = area_name
|
||||||
|
|
||||||
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 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"
|
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
|
end
|
||||||
|
|
||||||
desc "Setup server files"
|
desc "Setup server files"
|
||||||
@ -50,7 +49,7 @@ end
|
|||||||
file "#{sandbox}/server.ini" => "server.ini" do |t|
|
file "#{sandbox}/server.ini" => "server.ini" do |t|
|
||||||
#first time the file is copied, we adjusts server settings to point to data files in our sandbox folder
|
#first time the file is copied, we adjusts server settings to point to data files in our sandbox folder
|
||||||
text = File.read(t.prerequisites.join)
|
text = File.read(t.prerequisites.join)
|
||||||
text.gsub!('/opt/osm/germany', "#{Dir.pwd}/sandbox/#{osm_data}")
|
text.gsub!('/opt/osm/germany', "#{Dir.pwd}/sandbox/#{area_name}")
|
||||||
file = File.new( t.name, "w+")
|
file = File.new( t.name, "w+")
|
||||||
file.puts text
|
file.puts text
|
||||||
file.close
|
file.close
|
||||||
|
Loading…
Reference in New Issue
Block a user