如何在QGIS中使用GDAL将许多光栅与python脚本合并?

2024-09-26 22:53:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我有许多光栅,我试图结合,以产生轮廓。它们是.bil格式的,所以我知道我需要先用gdal来翻译它们,但我的尝试都没有奏效。

我尝试过使用gdal_翻译和gdal_合并,但没有成功。下面是我尝试合并的两个BIL的样本。

import subprocess
import sys
import gdal

#imagea ='C:\\Users\\jeswa\\Desktop\\New folder\\N34_E\\n34_e024_1arc_v3.bil'
#imageb ='C:\\Users\\jeswa\\Desktop\\New folder\\N34_E\\n34_e025_1arc_v3.bil'
#output = 'C:\\Users\\jeswa\\Desktop\\test'
#subprocess.call(['gdal_merge', '-o', output, imagea, imageb])

Traceback (most recent call last):
  File "C:\OSGEO4~1\apps\Python37\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\OSGEO4~1\apps\Python37\lib\subprocess.py", line 304, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\OSGEO4~1\apps\Python37\lib\subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "C:\OSGEO4~1\apps\Python37\lib\subprocess.py", line 1155, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Tags: appsinpyimportliblineusersfile

热门问题