auto-sync: 2026-05-13 21:40:01

This commit is contained in:
Stream
2026-05-13 21:40:05 +03:00
parent 9f99d0c42f
commit d9d6ad9821

View File

@@ -0,0 +1,65 @@
#!/bin/bash
set -e
TMP='/tmp/tri_gen'
TERRAIN_DIR='/home/slin/enduro-trails/data/terrain'
TRI_DIR="${TERRAIN_DIR}/tri"
echo '=== REGENERATE TRI TILES - thresholds x1.3 ==='
echo "Start: $(date)"
# New color ramp with thresholds increased by 30%
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
echo 'Color ramp:'
cat $TMP/tri_color_v3.txt
echo ''
echo '=== Step 1: Generate colored TRI ==='
gdaldem color-relief \
$TMP/tri_raw.tif \
$TMP/tri_color_v3.txt \
$TMP/tri_colored_v3.tif \
-alpha \
-of GTiff \
-co COMPRESS=LZW \
-co BIGTIFF=YES
echo ''
echo '=== Step 2: Regenerate tiles ==='
rm -rf ${TRI_DIR}
mkdir -p ${TRI_DIR}
gdal2tiles.py \
--zoom=5-12 \
--processes=4 \
--tilesize=256 \
--webviewer=none \
$TMP/tri_colored_v3.tif \
${TRI_DIR}/
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)"