Routing: merge the countries' extracts with osmium before Valhalla, which fails on overlapping extracts
CI / check (push) Successful in 23s
CI / deploy (push) Successful in 12s

This commit is contained in:
randy committed 2026-11-14 12:11:17 +01:00
1 parent 92efe118b0
commit acf5256c74
4 files changed
+85 -8

No files matched your search

+10 -3
View File
@@ -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 ""
}