I'm using the Graphic Modeler/Processing Modeler to automate a process. The last step in this process is Merging three different Raster Layers. I'm using the "Merge Raster Layers" from Saga 2.0.8. Is if it is possible to specify the order in which these are merged?

I would like it in this order.

-#1 WaterStreams - Top

-#2 Grid with WaterStreams area (Watershed?)- Middle

-#3 Height Model (DEM) - Bottom

So #3 should be at the bottom, then #2 will be added on top of this and then #3 will be added at the top.

Pretty much a DEM with WaterShed burned into it, with WaterStreams burned through the DEM and WaterShed. If this makes sense?

If I do it manually and use the toolbox and Merge Raster Layers it's no problem (First value in grid order), but in the automated process I can't specify the correct order.

Update: https://i.sstatic.net/kuGYS.png

Update1::Tried editing the .model file, rearranging the order of #1, #2, #3, but no luck, either I'm not doing it right, or it doesn't work that way.

Update2:Tried a few more things using textpad editing, also tried doing two different "Merge Raster Layer" after each other, but no luck. It always puts #3 at the top, though I need it to be at the bottom.

  • 3
    Perhaps you can run your model as a python script, this way you can make some slight edits to the code which hopefully would sort the layers in the correct order. You can right-click on the model in Processing Toolbox and select Save as Python script. Or you can include the python script in your question by edit and maybe others can help you there. You can then re-import the modified Python script via Processing Toolbox > Scripts > Tools > Add script from file
    – Joseph
    Commented Dec 23, 2014 at 15:04
  • Thank you! I will try this, however I dont see the Save as Python script, browsing the forums, it appears to have been removed temporarily. .model QGIS 2.6 .model QGIS 2.4 Edit: I've added the model from both 2.4 and 2.6, I can't get it to save as Python Script without it giving me errors (in 2.4), can somoene convert it for me and upload it, I would really appreciate it. :) Commented Dec 29, 2014 at 9:49
  • Probably no longer applies now but GDAL has a Merge tool which may allow you to merge rasters in order.
    – Joseph
    Commented Jun 28, 2017 at 9:58


Browse other questions tagged or ask your own question.