From 4d17fc51d9593b940514b462112e0f8ca693fe3e Mon Sep 17 00:00:00 2001 From: Stream Date: Thu, 14 May 2026 00:50:11 +0300 Subject: [PATCH] auto-sync: 2026-05-14 00:50:01 --- tasks/enduro-trails/scripts/gen_tri_v4.sh | 64 +++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tasks/enduro-trails/scripts/gen_tri_v4.sh diff --git a/tasks/enduro-trails/scripts/gen_tri_v4.sh b/tasks/enduro-trails/scripts/gen_tri_v4.sh new file mode 100644 index 0000000..e612229 --- /dev/null +++ b/tasks/enduro-trails/scripts/gen_tri_v4.sh @@ -0,0 +1,64 @@ +#!/bin/bash +set -e + +echo '=== REGENERATE TRI TILES - higher thresholds (x1.5) ===' +echo "Start: $(date)" + +TMP='/tmp/tri_gen' +TERRAIN_DIR='/home/slin/enduro-trails/data/terrain' +TRI_DIR="${TERRAIN_DIR}/tri" + +cat > $TMP/tri_color_v4.txt << 'RAMP' +nv 0 0 0 0 +0 0 0 0 0 +5 0 0 0 0 +6 255 255 100 60 +7.5 255 230 50 100 +10 255 200 0 140 +13 255 150 0 180 +20 255 100 0 200 +30 230 50 0 220 +40 200 0 0 235 +60 180 0 50 245 +100 150 0 100 255 +RAMP + +echo 'Color ramp:' +cat $TMP/tri_color_v4.txt + +echo '' +echo '=== Step 1: Color relief ===' +gdaldem color-relief \ + $TMP/tri_raw_full.tif \ + $TMP/tri_color_v4.txt \ + $TMP/tri_colored_v4.tif \ + -alpha \ + -of GTiff \ + -co COMPRESS=LZW \ + -co BIGTIFF=YES + +echo '' +echo '=== Step 2: Generate tiles (bilinear) ===' +rm -rf ${TRI_DIR} +mkdir -p ${TRI_DIR} + +gdal2tiles.py \ + --zoom=5-12 \ + --processes=4 \ + --tilesize=256 \ + --resampling=bilinear \ + --webviewer=none \ + $TMP/tri_colored_v4.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)"