QGIS – Using GDAL Merge within a QGIS Model Designer

gdal-mergeqgisqgis-modeler

I am attempting to include GDAL's merge but having difficulty with the "Additional creation options" field. I would like to include both COMPRESS=LZW and TILED=YES however I cannot seem to find the formatting that satisfies. I have tried things like:

  • COMPRESS=LZW TILED=YES
  • COMPRESS=LZW, TILED=YES
  • 'COMPRESS'=LZW, 'TILED'=YES
  • {'COMPRESS':LZW, 'TILED':YES}

and I receive the following sort of errors:

Warning 6
Warning 6: 'LZW, TILED=YES' is an unexpected value for COMPRESS creation option of type string-select.
Warning 5: COMPRESS=LZW, TILED=YES value not recognised, ignoring.

It seems to be parsing my inputs in the strangest ways. Admittedly, I have not kept an exhaustive list of my various inputs.

drop down arrow at the end of field

This drop down arrow appears to do nothing, as well.

In the GUI to run the algorithm the feature is well structured, as is the command line, but in this case I must bring merge into a model and cannot find the appropriate directions.

I have looked here and decided to try the dictionary format. This made it seem like a simple string would work, so I added the comma separator. This documentation made it seem as though no comma should be necessary (see fig 9.15). The GDAL.org entry did not really clear things up with -co <NAME=VALUE> not really revealing how to include more than one (again, through the model specifically, the command line format is known).

It seems as though "Additional creation options" is only meant to take a single option, and should not be pluralized. More likely, I just don't know how to formulate it. Please help.

Best Answer

There are two different ways you can reach your desired output.

The first (specifically asked by the OP), is to use the additional creation options. The correct syntax is to separate the entries with the pipe "|" character (shift + \). Please reference this post.

COMPRESS=LZW|TILED=YES

The second, using the additional command-line parameters. I have seen this section used most since it ties into how users would enter the parameters into a shell or python script.

-co COMPRESS=LZW -co TILED=YES

Note: Some options will require the -co, while others require a different prefix and others non at all. Check out the gdal documentation.

enter image description here

Related Question