Initial Watermaps import

This commit is contained in:
BuTzZ
2026-07-24 11:29:24 +02:00
commit 57f7b4dedb
129 changed files with 43136 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IMAGE_NAME="${WATERMAPS_IMPORT_IMAGE:-${SEA_COMPASS_IMPORT_IMAGE:-watermaps-geofabrik-importer}}"
DATABASE_URL="${DATABASE_URL:-postgres://seacompass:seacompass@localhost:5432/seacompass}"
if [[ "$#" -lt 1 ]]; then
echo "Usage: DATABASE_URL=postgres://... ./scripts/import-geofabrik-docker.sh data/geofabrik/region-latest.osm.pbf [...]" >&2
exit 1
fi
docker build -f "$ROOT_DIR/docker/geofabrik-import/Dockerfile" -t "$IMAGE_NAME" "$ROOT_DIR"
for input_path in "$@"; do
host_path="$(realpath "$input_path")"
case "$host_path" in
"$ROOT_DIR"/*) ;;
*)
echo "PBF file must be inside the project directory so it can be mounted into the importer: $input_path" >&2
exit 1
;;
esac
relative_path="$(realpath --relative-to="$ROOT_DIR" "$host_path")"
docker run --rm \
--network host \
-v "$ROOT_DIR:/workspace" \
-e DATABASE_URL="$DATABASE_URL" \
"$IMAGE_NAME" \
/workspace/scripts/import-geofabrik.sh "/workspace/$relative_path"
done