From 084d6caf65ea887eca1dcbc6d28f46866882f649 Mon Sep 17 00:00:00 2001 From: Stream Date: Thu, 14 May 2026 00:00:13 +0300 Subject: [PATCH] auto-sync: 2026-05-14 00:00:01 --- .../enduro-trails/scripts/gen_tri_bilinear.sh | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tasks/enduro-trails/scripts/gen_tri_bilinear.sh diff --git a/tasks/enduro-trails/scripts/gen_tri_bilinear.sh b/tasks/enduro-trails/scripts/gen_tri_bilinear.sh new file mode 100644 index 0000000..8bfc464 --- /dev/null +++ b/tasks/enduro-trails/scripts/gen_tri_bilinear.sh @@ -0,0 +1,66 @@ +#!/bin/bash +set -e + +echo '=== REGENERATE TRI TILES WITH BILINEAR RESAMPLING ===' +echo "Start: $(date)" + +TMP='/tmp/tri_gen' +TERRAIN_DIR='/home/slin/enduro-trails/data/terrain' +TRI_DIR="${TERRAIN_DIR}/tri" + +echo '' +echo '=== Step 1: Color relief (thresholds x1.3, same as before) ===' +# tri_raw_full.tif already exists from previous run + +cat > $TMP/tri_color_v3.txt << 'RAMP' +nv 0 0 0 0 +0 0 0 0 0 +3 0 0 0 0 +4 255 255 100 60 +5 255 230 50 100 +6.5 255 200 0 140 +9 255 150 0 180 +13 255 100 0 200 +20 230 50 0 220 +26 200 0 0 235 +39 180 0 50 245 +65 150 0 100 255 +RAMP + +gdaldem color-relief \ + $TMP/tri_raw_full.tif \ + $TMP/tri_color_v3.txt \ + $TMP/tri_colored_smooth.tif \ + -alpha \ + -of GTiff \ + -co COMPRESS=LZW \ + -co BIGTIFF=YES +echo "Color relief done" + +echo '' +echo '=== Step 2: Generate tiles with bilinear resampling ===' +rm -rf ${TRI_DIR} +mkdir -p ${TRI_DIR} + +gdal2tiles.py \ + --zoom=5-12 \ + --processes=4 \ + --tilesize=256 \ + --resampling=bilinear \ + --webviewer=none \ + $TMP/tri_colored_smooth.tif \ + ${TRI_DIR}/ +echo "Tiles generated" + +echo '' +echo '=== Step 3: 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 + +echo '' +du -sh ${TRI_DIR} +echo '=== DONE ===' +echo "End: $(date)"