70 lines
2.3 KiB
Bash
70 lines
2.3 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
echo '=== DOWNLOAD MISSING SRTM FILES (E041-E046, N54-N56) ==='
|
|
echo "Start: $(date)"
|
|
|
|
SRTM_DIR='/home/slin/enduro-trails/data/srtm'
|
|
cd $SRTM_DIR
|
|
|
|
# Missing tiles for the gap between Vladimir (E040) and Cheboksary (E047)
|
|
# Latitudes N54-N56 (main coverage area)
|
|
TILES="N54E041 N54E046 N55E041 N55E042 N55E043 N55E044 N55E045 N55E046 N56E041 N56E042 N56E043 N56E044 N56E045 N56E046"
|
|
|
|
# Also fill N53 gap
|
|
TILES="$TILES N53E046 N53E047"
|
|
|
|
# SRTM v4.1 from CGIAR (free, no auth needed)
|
|
# URL pattern: https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/
|
|
# Alternative: NASA EarthData (needs auth) or viewfinderpanoramas.org
|
|
|
|
# Use viewfinderpanoramas.org - direct HGT downloads
|
|
BASE_URL="https://viewfinderpanoramas.org/dem3"
|
|
|
|
count=0
|
|
for tile in $TILES; do
|
|
if [ -f "${tile}.hgt" ]; then
|
|
echo "SKIP: ${tile}.hgt already exists"
|
|
continue
|
|
fi
|
|
|
|
# Extract lat letter (N/S) and first 2 digits for directory
|
|
lat_letter=${tile:0:1}
|
|
lat_num=${tile:1:2}
|
|
|
|
# viewfinderpanoramas uses zip files grouped by latitude band
|
|
# Try direct NASA SRTM mirror instead
|
|
# https://e4ftl01.cr.usgs.gov/MEASURES/SRTMGL1.003/2000.02.11/
|
|
# Needs .SRTMGL1.hgt.zip format - requires auth
|
|
|
|
# Use OpenTopography or direct SRTM mirror
|
|
# Simplest: use elevation-tiles from AWS (no auth)
|
|
echo "Downloading ${tile}..."
|
|
|
|
# Try USGS SRTM mirror (no auth for SRTM3/1-arc-second)
|
|
wget -q "https://firmware.ardupilot.org/SRTM/ap_srtm3/${tile}.hgt.zip" -O "/tmp/${tile}.hgt.zip" 2>/dev/null
|
|
if [ $? -eq 0 ] && [ -s "/tmp/${tile}.hgt.zip" ]; then
|
|
unzip -o -q "/tmp/${tile}.hgt.zip" -d $SRTM_DIR/
|
|
rm -f "/tmp/${tile}.hgt.zip"
|
|
echo " OK: ${tile}.hgt ($(du -h ${tile}.hgt | cut -f1))"
|
|
count=$((count + 1))
|
|
else
|
|
echo " FAIL: ${tile} not available from ardupilot mirror"
|
|
# Try alternative
|
|
wget -q "http://viewfinderpanoramas.org/dem3/${lat_letter}${lat_num}/${tile}.hgt.zip" -O "/tmp/${tile}.hgt.zip" 2>/dev/null
|
|
if [ $? -eq 0 ] && [ -s "/tmp/${tile}.hgt.zip" ]; then
|
|
unzip -o -q "/tmp/${tile}.hgt.zip" -d $SRTM_DIR/
|
|
rm -f "/tmp/${tile}.hgt.zip"
|
|
echo " OK (viewfinder): ${tile}.hgt"
|
|
count=$((count + 1))
|
|
else
|
|
echo " FAIL: ${tile} not found"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "Downloaded: $count new files"
|
|
echo "Total HGT files: $(ls $SRTM_DIR/*.hgt | wc -l)"
|
|
echo "End: $(date)"
|