Share this question

Welcome to Teachnovice Q&A, where you can ask questions and receive answers from other members of the community.

This is a collaboratively edited question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to merge images per day using gdal-merge and cmd(.bat file)

0 like 0 dislike
322 views

There are 4 to 5 projected images in one day. Let's say I have all the projected images for 3 days. For day 1, the file name are:

T2010232034000.L2.Tera.tif
T2010232035000.L2.Tera.tif
T2010232036000.L2.Tera.tif
T2010232037000.L2.Tera.tif

For day 2, the file name are:

T2010233045000.L2.Tera.tif
T2010233046000.L2.Tera.tif
T2010233047000.L2.Tera.tif
T2010233048000.L2.Tera.tif
T2010233049000.L2.Tera.tif

For day 3, the file name are:

T2010234050000.L2.Tera.tif
T2010234051000.L2.Tera.tif
T2010234052000.L2.Tera.tif
T2010234053000.L2.Tera.tif
T2010234054000.L2.Tera.tif 

How will I merge all the images that are for day 1, for day 2 and for day 3 and save each merged images to a new directory leaving only the T/datayear/juliandate as the filename for each day. Merging files is easy but doing it in batch and merging based on the images per day is making me crazy.

Note: T2010232034000 = Terra/Data Year/Julian Date/HH/MM/SS

Code for merging files:

set in_path=path_to_in_file
set out_path=path_to_out_file

md %out_path%

cd /d %in_path%

FORFILES /C "cmd /c gdal_merge.py -n 0 -a_nodata -32767 -of GTiff -o @path %out_path%\@fname.tif"
asked Oct 23, 2014 by user  

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...