From d1a3375370a8e94414188ef3d9c9f020046f896f Mon Sep 17 00:00:00 2001 From: Stream Date: Thu, 14 May 2026 01:40:05 +0300 Subject: [PATCH] auto-sync: 2026-05-14 01:40:01 --- tasks/enduro-trails/scripts/gen_tri_dual.sh | 100 ++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 tasks/enduro-trails/scripts/gen_tri_dual.sh diff --git a/tasks/enduro-trails/scripts/gen_tri_dual.sh b/tasks/enduro-trails/scripts/gen_tri_dual.sh new file mode 100644 index 0000000..a77cdf1 --- /dev/null +++ b/tasks/enduro-trails/scripts/gen_tri_dual.sh @@ -0,0 +1,100 @@ +#!/bin/bash +set -e + +echo '=== TRI TILES: dual thresholds (z5-8 soft, z9-12 strict) ===' +echo "Start: $(date)" + +TMP='/tmp/tri_gen' +TERRAIN_DIR='/home/slin/enduro-trails/data/terrain' +TRI_DIR="${TERRAIN_DIR}/tri" + +# === SOFT ramp for overview zooms (z5-8) — start at TRI=3 === +cat > $TMP/tri_color_soft.txt << 'RAMP' +nv 0 0 0 0 +0 0 0 0 0 +2 0 0 0 0 +3 255 255 100 40 +5 255 230 50 80 +8 255 200 0 120 +12 255 150 0 160 +18 255 100 0 190 +25 230 50 0 210 +35 200 0 0 230 +50 180 0 50 245 +80 150 0 100 255 +RAMP + +# === STRICT ramp for detail zooms (z9-12) — start at TRI=10 === +cat > $TMP/tri_color_strict.txt << 'RAMP' +nv 0 0 0 0 +0 0 0 0 0 +9 0 0 0 0 +10 255 255 100 60 +14 255 230 50 100 +18 255 200 0 140 +24 255 150 0 180 +35 255 100 0 200 +45 230 50 0 220 +60 200 0 0 235 +80 180 0 50 245 +100 150 0 100 255 +RAMP + +echo 'Soft ramp (z5-8):' +cat $TMP/tri_color_soft.txt +echo '' +echo 'Strict ramp (z9-12):' +cat $TMP/tri_color_strict.txt + +echo '' +echo '=== Step 1: Generate soft colored TRI ===' +gdaldem color-relief \ + $TMP/tri_raw_full.tif \ + $TMP/tri_color_soft.txt \ + $TMP/tri_colored_soft.tif \ + -alpha -of GTiff -co COMPRESS=LZW -co BIGTIFF=YES + +echo '' +echo '=== Step 2: Generate strict colored TRI ===' +gdaldem color-relief \ + $TMP/tri_raw_full.tif \ + $TMP/tri_color_strict.txt \ + $TMP/tri_colored_strict.tif \ + -alpha -of GTiff -co COMPRESS=LZW -co BIGTIFF=YES + +echo '' +echo '=== Step 3: Generate tiles z5-8 (soft) ===' +rm -rf ${TRI_DIR} +mkdir -p ${TRI_DIR} + +gdal2tiles.py \ + --zoom=5-8 \ + --processes=4 \ + --tilesize=256 \ + --resampling=bilinear \ + --webviewer=none \ + $TMP/tri_colored_soft.tif \ + ${TRI_DIR}/ + +echo '' +echo '=== Step 4: Generate tiles z9-12 (strict) ===' +gdal2tiles.py \ + --zoom=9-12 \ + --processes=4 \ + --tilesize=256 \ + --resampling=bilinear \ + --webviewer=none \ + $TMP/tri_colored_strict.tif \ + ${TRI_DIR}/ + +echo '' +echo '=== Stats ===' +for z in 5 6 7 8 9 10 11 12; do + total=$(find ${TRI_DIR}/$z/ -name '*.png' 2>/dev/null | wc -l) + nonempty=$(find ${TRI_DIR}/$z/ -name '*.png' -size +400c 2>/dev/null | wc -l) + echo " zoom $z: $total total, $nonempty non-empty" +done + +du -sh ${TRI_DIR} +echo '=== DONE ===' +echo "End: $(date)"