When I merge a lot of raster files I don't know what is the order that they forward in the new file (stacking).

How do I know the name of band 1 (and others ones) in the other file that I have had created.

Is there a default rule to it?

  • If you know some details of your bands (e.g. max, min pixel values), you could look at the Histogram by right-clicking your raster and going to Properties > Histogram. – Joseph Dec 8 '16 at 15:13

The stacking order is the order in which you list the files in the command. I see you have another question about this tool. If you add a bunch of files selected from the file system, the order will most likely be the order they are in the file system and that might not be the stacking order you want, but you can edit the command by pressing the little yellow pencil icon next to the GDAL commandline window (see the answer to your previous question).

For example:

gdal_merge.py -separate -o out.tif in1.tif in2.tif in3.tif

would give you a 3 band raster where in1 is in the red band (band 1), in2 is in the green band (band 2) and in3 is in the blue band (band 3). But change the order in the command:

gdal_merge.py -separate -o out.tif in3.tif in2.tif in1.tif

would give you a 3 band raster where in3 is now in the red band, in2 is in the green band and in1 is now in the blue band.

| improve this answer | |

Your Answer

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

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