0

I'm new to Python. I tried to call gdal_merge.py

import sys

sys.path.append('C:\Program Files\QGIS 3.6\bin\gdal_merge')
import gdal_merge as gm
gm.main(['', '-o','C:\12\Merged.tif','C:\..\TTC01847_1.tif','C:\..\TTC01847_2.tif','C:\..\TTC01847_3.tif','C:\..\TTC01847_4.tif'])

import os, subprocess

gm=os.path.join('C:\\','OSGeo4W64','bin','gdal_merge.py')
merge_command = ["python", gm, "-o", "C:\..\Merged.tif","C:\..\TTC01847_1.tif","C:\..\TTC01847_2.tif","C:\..\TTC01847_3.tif","C:\..\TTC01847_4.tif"]
subprocess.call(merge_command,shell=True)

I receved "Traceback (most recent call last): File "C:/../../merge1.py", line 3, in import gdal_merge as gm ModuleNotFoundError: No module named 'gdal_merge'

Merged1.py is the name of save the script.

What do I have to do to solve the problem and merge the files?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.