#!/bin/bash set -e cd /home/riricdev/zektyc/data/maxspeed echo "=== Étape 1: Filtrer highways du planet ===" if [ ! -f planet-highways.pbf ]; then echo "Extraction des highways..." osmium tags-filter planet-latest.osm.pbf w/highway -o planet-highways.pbf --overwrite ls -lh planet-highways.pbf else echo "planet-highways.pbf existe déjà" fi echo "" echo "=== Étape 2: Découper en bandes longitude ===" mkdir -p bands raw # 12 bandes de 30° : -180..-150, -150..-120, ..., 150..180 BAND_SIZE=30 for i in $(seq 0 11); do LON_START=$(( -180 + i * BAND_SIZE )) LON_END=$(( LON_START + BAND_SIZE )) BAND="band_${LON_START}_${LON_END}" if [ -f "raw/${BAND}.raw" ]; then echo " ${BAND} déjà fait, skip" continue fi if [ ! -f "bands/${BAND}.pbf" ]; then echo " Extraction bande ${LON_START}..${LON_END}..." osmium extract -b ${LON_START},-60,${LON_END},85 planet-highways.pbf -o "bands/${BAND}.pbf" --overwrite ls -lh "bands/${BAND}.pbf" fi echo " Build bande ${LON_START}..${LON_END}..." ./build_band "bands/${BAND}.pbf" "raw/${BAND}.raw" ls -lh "raw/${BAND}.raw" rm -f "bands/${BAND}.pbf" echo "" done echo "=== Étape 3: Merge toutes les bandes ===" ./merge_grid grid-planet raw/*.raw echo "=== Terminé! ===" ls -lh grid-planet/