correct Photon download URL

This commit is contained in:
Shautvast 2026-03-30 11:53:15 +02:00
parent ff05801c3f
commit 09be2264f0

View file

@ -1,27 +1,22 @@
#!/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.
# Download Photon's pre-built country geocoding index from GraphHopper.
# Uses the 1.0 stable release which matches komoot/photon:latest.
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}"
# Full country name as used in the GraphHopper download path
COUNTRY="${PHOTON_COUNTRY:-netherlands}"
PHOTON_VERSION="${PHOTON_VERSION:-1.0}"
mkdir -p "$PHOTON_DATA"
echo "=== Downloading Photon index for country: $COUNTRY_CODE ==="
PHOTON_URL="https://download1.graphhopper.com/public/europe/${COUNTRY}/photon-db-${COUNTRY}-${PHOTON_VERSION}-latest.tar.bz2"
# 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"
echo "=== Downloading Photon index: $PHOTON_URL ==="
wget -O "${PHOTON_DATA}/photon-db.tar.bz2" "$PHOTON_URL"
wget -O - "$PHOTON_URL" | bzip2 -cd | tar x -C "$PHOTON_DATA"
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"
echo "Photon index extracted to $PHOTON_DATA"
echo "Add a volume mount to the photon service: ../data/photon:/photon/photon_data"