Routing: merge the countries' extracts with osmium before Valhalla, which fails on overlapping extracts
This commit is contained in:
1 parent
92efe118b0
commit
acf5256c74
4 files changed
+85
-8
No files matched your search
+10
-3
@@ -61,9 +61,14 @@ build() {
|
||||
mkdir -p "$S" "$R/pbf"
|
||||
mv "$R/build-request.json" "$S/request.json"
|
||||
regions=$(python3 -c 'import json,sys; print(" ".join(json.load(open(sys.argv[1]))["regions"]))' "$S/request.json")
|
||||
for code in $regions; do
|
||||
ln "/data/geofabrik_cache/$code.osm.pbf" "$R/pbf/" || { status error "" "no downloaded extract for $code"; return 1; }
|
||||
done
|
||||
pbf=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("pbf", ""))' "$S/request.json")
|
||||
if [ -n "$pbf" ]; then # several countries, merged by maptool (Valhalla breaks on overlapping extracts)
|
||||
ln "/data/$pbf" "$R/pbf/" || { status error "" "missing $pbf"; return 1; }
|
||||
else
|
||||
for code in $regions; do
|
||||
ln "/data/geofabrik_cache/$code.osm.pbf" "$R/pbf/" || { status error "" "no downloaded extract for $code"; return 1; }
|
||||
done
|
||||
fi
|
||||
: > "$R/build.log"
|
||||
run() { # step command...
|
||||
status running "$1"
|
||||
@@ -80,6 +85,8 @@ build() {
|
||||
config "$R"
|
||||
mv "$S/request.json" "$R/built.json"
|
||||
rm -rf "$S" "$R/pbf"
|
||||
# Not if a newer request (with a freshly merged file) is already waiting.
|
||||
[ -n "$pbf" ] && [ ! -f "$R/build-request.json" ] && rm -f "/data/$pbf"
|
||||
serve
|
||||
status done ""
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user