#!/bin/bash # Download OSM data for Vietnam/Southeast Asia # This script downloads OpenStreetMap data files for use with Valhalla set -e # Create custom_files directory if it doesn't exist mkdir -p custom_files echo "πŸ—ΊοΈ Downloading OpenStreetMap data for Vietnam..." # Download Vietnam OSM data from Geofabrik VIETNAM_URL="https://download.geofabrik.de/asia/vietnam-latest.osm.pbf" VIETNAM_FILE="custom_files/vietnam-latest.osm.pbf" if [ ! -f "$VIETNAM_FILE" ]; then echo "πŸ“₯ Downloading Vietnam OSM data..." wget -O "$VIETNAM_FILE" "$VIETNAM_URL" echo "βœ… Downloaded Vietnam OSM data" else echo "πŸ“ Vietnam OSM data already exists" fi # Optional: Download other regional data read -p "Do you want to download additional regional data? (y/N): " download_more if [[ $download_more =~ ^[Yy]$ ]]; then echo "Available regions:" echo "1. Southeast Asia (larger file, ~2GB)" echo "2. Cambodia" echo "3. Laos" echo "4. Thailand" echo "5. Myanmar" read -p "Select region (1-5): " region_choice case $region_choice in 1) REGION_URL="https://download.geofabrik.de/asia/southeast-asia-latest.osm.pbf" REGION_FILE="custom_files/southeast-asia-latest.osm.pbf" ;; 2) REGION_URL="https://download.geofabrik.de/asia/cambodia-latest.osm.pbf" REGION_FILE="custom_files/cambodia-latest.osm.pbf" ;; 3) REGION_URL="https://download.geofabrik.de/asia/laos-latest.osm.pbf" REGION_FILE="custom_files/laos-latest.osm.pbf" ;; 4) REGION_URL="https://download.geofabrik.de/asia/thailand-latest.osm.pbf" REGION_FILE="custom_files/thailand-latest.osm.pbf" ;; 5) REGION_URL="https://download.geofabrik.de/asia/myanmar-latest.osm.pbf" REGION_FILE="custom_files/myanmar-latest.osm.pbf" ;; *) echo "Invalid selection" exit 1 ;; esac if [ ! -f "$REGION_FILE" ]; then echo "πŸ“₯ Downloading additional regional data..." wget -O "$REGION_FILE" "$REGION_URL" echo "βœ… Downloaded additional regional data" else echo "πŸ“ Regional data already exists" fi fi echo "" echo "πŸŽ‰ OSM data download complete!" echo "πŸ“ Files saved to: custom_files/" ls -lh custom_files/ echo "" echo "πŸš€ Next steps:" echo "1. Run: docker-compose up -d valhalla" echo "2. Wait for data processing to complete (may take 10-30 minutes)" echo "3. Test: curl http://localhost:8002/status" echo "" echo "πŸ’‘ Tips:" echo "- Larger OSM files take longer to process but provide better coverage" echo "- Vietnam data (~100MB) is sufficient for most Vietnamese locations" echo "- Southeast Asia data (~2GB) covers the entire region"