maps/backend/scripts/04_import_geocoding.sh
2026-03-30 11:01:20 +02:00

27 lines
1 KiB
Bash
Executable file

#!/bin/bash
# scripts/04_import_geocoding.sh
# Download Photon's pre-built country geocoding index.
# This avoids needing to run Nominatim (heavy, needs Java).
# Photon provides ready-to-use country extracts.
set -euo pipefail
PHOTON_DATA="/data/photon"
# Change COUNTRY_CODE to match your region (nl=Netherlands, de=Germany, fr=France, etc.)
COUNTRY_CODE="${PHOTON_COUNTRY_CODE:-nl}"
mkdir -p "$PHOTON_DATA"
echo "=== Downloading Photon index for country: $COUNTRY_CODE ==="
# Photon country extracts from GraphHopper (maintained by komoot/photon project)
PHOTON_URL="https://download1.graphhopper.com/public/extracts/by-country-code/${COUNTRY_CODE}/photon-db-${COUNTRY_CODE}-latest.tar.bz2"
wget -O "${PHOTON_DATA}/photon-db.tar.bz2" "$PHOTON_URL"
echo "=== Extracting Photon index ==="
tar -xjf "${PHOTON_DATA}/photon-db.tar.bz2" -C "$PHOTON_DATA"
rm "${PHOTON_DATA}/photon-db.tar.bz2"
echo "Photon index ready at $PHOTON_DATA"
echo "Mount $PHOTON_DATA/photon_data into the photon container as /photon/photon_data"