首页 > 解决方案 > 如何使用 GDAL 在 QGIS 中将许多栅格与 python 脚本合并?

问题描述

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

我尝试使用 gdal_translate 和 gdal_merge 没有成功。下面是我尝试合并的两个 .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

标签: pythonmergerastergdalqgis

解决方案


推荐阅读