Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My goal is process fifteen Landsat-8 scenes with three bands. I need to rescale the pixel depth from 16 bit to 8 bit, stack three bands and mosaic all them. This job must be making via open source solutions. Below is my checklist with all experiments that I’ve done thus far.

Fifteen Landsat-8 Jobs

This is my command list for six scenes:

gdal_merge.bat -separate -of GTiff -co TFW=YES -o LC82180762013253LGN00_RGB654.TIF LC82180762013253LGN00_B6.TIF LC82180762013253LGN00_B5.TIF LC82180762013253LGN00_B4.TIF
gdal_merge.bat -separate -of GTiff -co TFW=YES -o LC82190752013244LGN00_RGB654.TIF LC82190752013244LGN00_B6.TIF LC82190752013244LGN00_B5.TIF LC82190752013244LGN00_B4.TIF
gdal_merge.bat -separate -of GTiff -co TFW=YES -o LC82190772013244LGN00_RGB654.TIF LC82190772013244LGN00_B6.TIF LC82190772013244LGN00_B5.TIF LC82190772013244LGN00_B4.TIF
gdal_merge.bat -separate -of GTiff -co TFW=YES -o LC82200742013251LGN00_RGB654.TIF LC82200742013251LGN00_B6.TIF LC82200742013251LGN00_B5.TIF LC82200742013251LGN00_B4.TIF
gdal_merge.bat -separate -of GTiff -co TFW=YES -o LC82200752013251LGN00_RGB654.TIF LC82200752013251LGN00_B6.TIF LC82200752013251LGN00_B5.TIF LC82200752013251LGN00_B4.TIF
gdal_merge.bat -separate -of GTiff -co TFW=YES -o LC82210752013242LGN00_RGB654.TIF LC82210752013242LGN00_B6.TIF LC82210752013242LGN00_B5.TIF LC82210752013242LGN00_B4.TIF

When I run GDAL_MERGE.BAT, something strange occurs. The looping doesn’t work and the process stops after the first stacked image:

gdal_merge.bat stops

This is the link to Google Docs with full explanation: http://goo.gl/gP2zpD | PDF: http://goo.gl/bIwz0W

Thank you,

Jorge Santos | http://www.processamentodigital.com.br/

share|improve this question
    
So, what is the question? You've got a good description, but its all statements. "Help me" doesn't really tell us what you need to know. What looping do you expect, given there isn't any loop in your command list? –  BradHards Nov 24 '13 at 2:07
    
gdal_merge.bat: allows to mosaic or compose bands. One command, One output raster 3-band. Six commands -> In teory, will be produce six raster with 3-bands, right? But don't work and I don't know why. –  Jorge Santos Nov 24 '13 at 3:02
    
It looks like the rest of the commands aren't being run. Why probably isn't a problem with the command, but perhaps with the script you're using to run it. You still haven't told us what the question is... –  BradHards Nov 24 '13 at 3:20
    
Hey BradHards, do you know another way to create a RGB Color Composite in batch mode with GDAL? I should try another solution ? This is my need, and I don't know what to do. Thanks. –  Jorge Santos Nov 24 '13 at 9:29

1 Answer 1

gdal_merge.bat is the name of your batch file, isn't it. The gdal command inside the batch file should be "gdalmerge.py"

On the other hand, I have two suggestions :

first, you should launch you script with Python instead of BAT. Second is to use vrt files. For instance, this could make :

import subprocess
subprocess.call(["gdalbuildvrt" ,"-separate", "LC82180762013253LGN00_RGB654.vrt" , "LC82180762013253LGN00_B*.TIF"])
subprocess.call(["gdal_translate" , "LC82180762013253LGN00_RGB654.vrt" , LC82180762013253LGN00_RGB654.tif"])

you could add a loop using "glob" in order to process all images.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.