Skip to content

Instantly share code, notes, and snippets.

@wangjiezhe
Last active March 2, 2026 02:18
Show Gist options
  • Select an option

  • Save wangjiezhe/3e9c8083997fd21eee726aad44deafa3 to your computer and use it in GitHub Desktop.

Select an option

Save wangjiezhe/3e9c8083997fd21eee726aad44deafa3 to your computer and use it in GitHub Desktop.
下载中国地区的 ASTER GDEM V3 高程数据
import os
import urllib.request
from concurrent.futures import ThreadPoolExecutor
from typing import List, Tuple
import pandas as pd
# 从控制台获取
SID = ""
UID = ""
df = pd.read_excel("中国经纬度范围.xlsx", header=None)
res: List[Tuple[int, int]] = []
for row in df.itertuples():
lat = int(row[1])
for i in range(2, len(row), 2):
if pd.isna(start := row[i]):
continue
end = row[i + 1]
res.extend((lat, lon) for lon in range(int(start), int(end) + 1))
failed: List[Tuple[int, int]] = []
def download_one(pair: Tuple[int, int]):
lat, lon = pair
base = f"ASTGTMV003_N{lat}E{lon:03d}"
filename = f"{base}.zip"
uri = (
f"https://bjdl.gscloud.cn/sources/download/"
f"aeab8000652a45b38afbb7ff023ddabb/{base}?sid={SID}&uid={UID}"
)
if not os.path.exists(filename):
try:
urllib.request.urlretrieve(uri, filename)
except Exception:
failed.append(pair)
def download_mt():
from tqdm import tqdm
with ThreadPoolExecutor(max_workers=5) as executor:
list(tqdm(executor.map(download_one, res), total=len(res), desc="下载进度: "))
print(f"\n下载失败: {failed}")
if __name__ == "__main__":
download_mt()
53 120 125
52 120 126
51 119 126
50 119 127
49 86 87 116 129
48 85 89 115 130 133 135
47 82 90 115 134
46 82 91 116 134
45 80 93 111 112 114 133
44 79 95 111 131
43 80 96 110 131
42 79 103 105 131
41 76 128
40 73 126
39 73 119 121 124
38 73 118 120 121
37 74 122
36 74 122
35 76 120
34 78 120
33 78 120
32 78 121
31 78 121
30 79 122
29 82 122
28 84 121
27 85 121
26 92 93 98 120
25 97 119 121 121
24 97 118 120 121
23 97 117 120 121
22 99 116 120 121
21 99 101 106 114 120 120
20 109 110
19 108 111
18 108 110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment