0

While merging the files using gdal_merge.py the following code works:

subprocess.call([sys.executable,gmerge,'-o','C:\\r.tif','-of','GTiff','D:\\a.tif','D:\\b.tif'],shell=True)

However, when the input files are numerous, each file can not be inserted separately. In this case, the following code does not work:

subprocess.call([sys.executable,gmerge,'-o','C:\\r.tif','-of','GTiff','D:\\*.tif'],shell=True)

I did not know how to input the input files. Any idea is welcomed.

asked Jul 9, 2014 at 15:11

1 Answer 1

1

you can loop on your files and append them to your list

command = [sys.executable,gmerge,'-o','C:\\r.tif','-of','GTiff']
images = glob.glob("D:\\*.tif")
for image in images:
 command.append(image)
subprocess.call(command)
answered Jul 9, 2014 at 15:36
1
  • No need to loop. This will work as well subprocess.call(command+images) Commented Jul 10, 2014 at 10:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.