0

Maybe I am not asking the question with the appropriate English words, but I would like to basically concatenate multi bands rasters (two or more) into a single raster with all the bands intact. The rasters have the same number of bands (4), and have all the same extent.

I can't find the proper tool in QGIS or either in GDAL. I first thought merge could do the job but it ends up with 4 bands having the average value of the 3rd band of each file for instance (for the 3rd band).

I can either use QGIS, GDAL with python, or directly GDAL in the terminal - all solutions are welcome.

Jouline
  • 63
  • 5
  • Do the images overlap? Can you illustrate what you are trying to accomplish? – Binx May 16 '23 at 19:36
  • @Binx the images overlap, they have exactly the same extent. It's just monthly composites of a Region of interest and I want to have only one file with all the information (all the bands). – Jouline May 16 '23 at 19:41
  • So you would want 8 bands on one image? How would you decide how to view the data? Which band would have priority over the other? – Binx May 16 '23 at 19:46
  • @Binx it's to train a deep-learning model, it's not for visualisation purpose – Jouline May 16 '23 at 19:47
  • In that case, I'd recommend using numpy then. Maybe look at numpy.stack – Binx May 16 '23 at 19:49
  • Ok thank you. I was also thinking about that but secretly hoping for a hidden tool in GDAL or QGIS. I'll try with OTB because it looks like what I am looking for! – Jouline May 16 '23 at 19:51
  • Most data that is feed into ML tasks are going to be using numpy anyways, but if you have to have a geotiff, then you could use look at this method – Binx May 16 '23 at 19:52

1 Answers1

0

You could perhaps use OTB which is executable from QGIS if you wish (or from the command prompt). The ConcatenateImage function seems to fit your need (https://www.orfeo-toolbox.org/CookBook/Applications/app_ConcatenateImages.html)

fab
  • 48
  • 4