38 lines
1.1 KiB
Bash
Executable file
38 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
# scripts/05_import_routing.sh
|
|
# Preprocess OSM data for OSRM routing.
|
|
# OSRM tools (osrm-extract, osrm-partition, osrm-customize) only exist inside
|
|
# the osrm/osrm-backend Docker image, so we run one-off containers here.
|
|
|
|
set -euo pipefail
|
|
|
|
PBF_FILE="${PBF_FILE:-/data/osm/region.osm.pbf}"
|
|
OSRM_DATA="/data/osrm"
|
|
NETWORK="maps-backend_maps-net"
|
|
|
|
for PROFILE in car foot bicycle; do
|
|
PROFILE_DIR="${OSRM_DATA}/${PROFILE}"
|
|
mkdir -p "$PROFILE_DIR"
|
|
cp "$PBF_FILE" "${PROFILE_DIR}/region.osm.pbf"
|
|
|
|
echo "=== Processing OSRM profile: $PROFILE ==="
|
|
|
|
podman run --rm \
|
|
-v "${PROFILE_DIR}:/data" \
|
|
docker.io/osrm/osrm-backend:latest \
|
|
osrm-extract -p "/opt/${PROFILE}.lua" /data/region.osm.pbf
|
|
|
|
podman run --rm \
|
|
-v "${PROFILE_DIR}:/data" \
|
|
docker.io/osrm/osrm-backend:latest \
|
|
osrm-partition /data/region.osrm
|
|
|
|
podman run --rm \
|
|
-v "${PROFILE_DIR}:/data" \
|
|
docker.io/osrm/osrm-backend:latest \
|
|
osrm-customize /data/region.osrm
|
|
|
|
echo "OSRM $PROFILE profile ready at $PROFILE_DIR"
|
|
done
|
|
|
|
echo "All OSRM profiles processed."
|