-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathout_warp_cmd.py
executable file
·30 lines (25 loc) · 1006 Bytes
/
out_warp_cmd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
import os
import sys
import shutil
srcName = "D:\jiangsushengshuju\DOM"
tgtName = "D:\jiangsushengshuju\DOM4326"
toEPSG = 4528
type = "g2w"
if __name__ == "__main__":
if os.path.exists(srcName) is False:
print "路径错误 %s" % (srcName)
sys.exit()
# 目录
if os.path.isdir(srcName):
for dirpath, dirnames, filenames in os.walk(srcName):
for filepath in filenames:
if filepath.lower().endswith(".tif"):
spath = os.path.join(dirpath, filepath)
tpath = tgtName + os.path.join(dirpath[len(srcName):], filepath)
# print spath
tdir = os.path.dirname(tpath)
if os.path.exists(tdir) is False:
os.makedirs(tdir)
print("gdalwarp -overwrite -r bilinear -dstnodata 999 -dstalpha -t_srs \"EPSG:4326\" %s %s" % (
spath, tpath))