2019-03-23 03:03:07 +00:00
|
|
|
#! /usr/bin/python
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
config_path = os.path.dirname(os.path.realpath(__file__)) + "/osmium-config/"
|
|
|
|
prefix = "osmium-cut-world-step-"
|
|
|
|
world_file = sys.argv[1]
|
|
|
|
state4 = ['nw', 'ne', 'sw', 'se']
|
|
|
|
state2 = ['s', 'n']
|
|
|
|
|
2019-03-23 06:24:53 +00:00
|
|
|
def run_cut(path, step, name, start_file=None):
|
2019-03-23 03:03:07 +00:00
|
|
|
if start_file != None:
|
2019-03-23 12:19:05 +00:00
|
|
|
print("Splitting world in 4...")
|
2019-03-23 07:09:20 +00:00
|
|
|
ret = os.system("osmium extract -c " + path + name + ".json " + start_file + " --overwrite")
|
|
|
|
if ret == 0:
|
|
|
|
os.system("mv n-pole.osm.pbf output/")
|
|
|
|
os.system("mv s-pole.osm.pbf output/")
|
2019-03-23 03:03:07 +00:00
|
|
|
else:
|
2019-03-23 07:09:20 +00:00
|
|
|
print("Building: " + name + "...")
|
2019-03-23 06:24:53 +00:00
|
|
|
os.system("osmium extract -c " + path + str(step) + "-" + name + ".json " + name + ".osm.pbf --overwrite")
|
2019-03-23 03:03:07 +00:00
|
|
|
|
2019-03-23 07:09:20 +00:00
|
|
|
run_cut(config_path + prefix, 1, "", world_file)
|
2019-03-23 03:03:07 +00:00
|
|
|
con_pre = config_path + prefix
|
|
|
|
for i in range(0, len(state4)):
|
2019-03-23 06:24:53 +00:00
|
|
|
run_cut(con_pre, 2, state4[i])
|
2019-03-23 03:03:07 +00:00
|
|
|
for j in range(0, len(state4)):
|
2019-03-23 06:24:53 +00:00
|
|
|
run_cut(con_pre, 3, state4[i] + "-" + state4[j])
|
2019-03-23 03:03:07 +00:00
|
|
|
for k in range(1, 4):
|
2019-03-23 06:24:53 +00:00
|
|
|
run_cut(con_pre, 4, state4[i] + "-" + state4[j] + "-" + str(k))
|
2019-03-23 03:03:07 +00:00
|
|
|
for l in range(0, len(state2)):
|
2019-03-23 06:24:53 +00:00
|
|
|
run_cut(con_pre, 5, state4[i] + "-" + state4[j] + "-" + str(k) + "-" + state2[l])
|