run osrm import on the host
This commit is contained in:
parent
2deb8731a4
commit
e99114b7b7
3 changed files with 57 additions and 8 deletions
17
README.md
17
README.md
|
|
@ -56,19 +56,20 @@ podman compose run --rm importer /app/scripts/02_import_tiles.sh
|
||||||
# Step 3: Import POI data into PostGIS
|
# Step 3: Import POI data into PostGIS
|
||||||
podman compose run --rm importer /app/scripts/03_import_pois.sh
|
podman compose run --rm importer /app/scripts/03_import_pois.sh
|
||||||
|
|
||||||
# Step 4: Download Photon geocoding index (~500 MB for Netherlands)
|
# Step 4: Download Photon geocoding index (~2.3 GB for Netherlands)
|
||||||
podman compose run --rm importer /app/scripts/04_import_geocoding.sh
|
podman compose run --rm importer /app/scripts/04_import_geocoding.sh
|
||||||
|
|
||||||
# Step 5: Preprocess OSRM routing graphs (runs osrm containers internally)
|
# Step 5: Preprocess OSRM routing graphs — run on the HOST, not in the container
|
||||||
podman compose run --rm importer /app/scripts/05_import_routing.sh
|
# (OSRM tools only exist inside the osrm/osrm-backend image)
|
||||||
|
bash backend/scripts/05_import_routing_host.sh ~/dev/maps/data
|
||||||
|
|
||||||
# Step 6: Register offline regions in the database
|
# Step 6: Register offline regions in the database
|
||||||
podman compose run --rm importer /app/scripts/06_build_offline_packages.sh
|
podman compose run --rm importer /app/scripts/06_build_offline_packages.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
To change the country, set `PHOTON_COUNTRY_CODE` before step 4:
|
To change the country for step 4, use the full country name:
|
||||||
```bash
|
```bash
|
||||||
PHOTON_COUNTRY_CODE=de podman compose run --rm importer /app/scripts/04_import_geocoding.sh
|
PHOTON_COUNTRY=germany podman compose run --rm importer /app/scripts/04_import_geocoding.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Start all services
|
### 3. Start all services
|
||||||
|
|
@ -86,10 +87,14 @@ podman compose restart osrm-driving osrm-walking osrm-cycling
|
||||||
|
|
||||||
### 4. Weekly data refresh
|
### 4. Weekly data refresh
|
||||||
|
|
||||||
Use `update_all.sh` for scheduled updates. It re-downloads the PBF only if the file has changed on the server (`wget -N`), then reimports everything.
|
Use `update_all.sh` for scheduled updates. It re-downloads the PBF only if the file has changed on the server (`wget -N`), then reimports everything. Note: OSRM preprocessing is not included — run it separately on the host if routing data has changed.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
podman compose run --rm importer /app/scripts/update_all.sh
|
podman compose run --rm importer /app/scripts/update_all.sh
|
||||||
|
|
||||||
|
# If routing data changed, also run on the host:
|
||||||
|
bash backend/scripts/05_import_routing_host.sh ~/dev/maps/data
|
||||||
|
podman compose restart osrm-driving osrm-walking osrm-cycling
|
||||||
```
|
```
|
||||||
|
|
||||||
To refresh only specific data (e.g. tiles changed but routing didn't):
|
To refresh only specific data (e.g. tiles changed but routing didn't):
|
||||||
|
|
|
||||||
43
backend/scripts/05_import_routing_host.sh
Executable file
43
backend/scripts/05_import_routing_host.sh
Executable file
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# scripts/05_import_routing_host.sh
|
||||||
|
# Run this directly on the Pi host (not inside the importer container).
|
||||||
|
# OSRM tools only exist inside the osrm/osrm-backend image.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
DATA_DIR="${1:-$HOME/dev/maps/data}"
|
||||||
|
OSRM_DIR="${DATA_DIR}/osrm"
|
||||||
|
PBF_FILE="${DATA_DIR}/osm/region.osm.pbf"
|
||||||
|
|
||||||
|
if [ ! -f "$PBF_FILE" ]; then
|
||||||
|
echo "ERROR: PBF file not found at $PBF_FILE"
|
||||||
|
echo "Run 01_download.sh first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for PROFILE in car foot bicycle; do
|
||||||
|
PROFILE_DIR="${OSRM_DIR}/${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."
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "All OSRM profiles processed."
|
||||||
|
|
@ -18,8 +18,9 @@ echo "=== Maps data import started at $(date -u) ==="
|
||||||
# Step 4: Download Photon geocoding index
|
# Step 4: Download Photon geocoding index
|
||||||
/app/scripts/04_import_geocoding.sh
|
/app/scripts/04_import_geocoding.sh
|
||||||
|
|
||||||
# Step 5: Preprocess OSRM routing graphs (runs osrm containers internally)
|
# Step 5: OSRM routing graphs — must be run on the HOST, not in this container
|
||||||
/app/scripts/05_import_routing.sh
|
echo "NOTE: Run OSRM preprocessing on the Pi host:"
|
||||||
|
echo " bash backend/scripts/05_import_routing_host.sh ~/dev/maps/data"
|
||||||
|
|
||||||
# Step 6: Register offline regions in the database
|
# Step 6: Register offline regions in the database
|
||||||
/app/scripts/06_build_offline_packages.sh
|
/app/scripts/06_build_offline_packages.sh
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue