13

In QGIS 2.XX, the drop-down menu bar tools had an editable call box at the bottom, where commands not available in the gui could be manually entered (by clicking a pencil button). In 3.0, the menu bar tools are the same as the GDAL tools found in the processing toolbox, which makes more sense, but now I do not see a way to add simple commands to a tool operation. The example I attach is the warp (reproject) tool, I wish to add the command "-wo CUTLINE_ALL_TOUCHED=TRUE". How do I do that?

Warp2.18.17 Warp3.0.0

  • Don't think you can at the moment. There is a feature request for this (I assume you are the same person who wrote the comment in the link?). You can add creation options but not warp options from the GUI. – Joseph Mar 6 '18 at 11:01
  • 3
    Yup, that was me. So now the only way to add additional commands is through the python console? Seems rather a regression for QGIS, the focus should be on the gui, I can do script-based commands easier in R – bhankerson Mar 7 '18 at 12:52
  • 1
    This is a crying shame. I see the feature request has been made a few times and rejected. You are right this is a retrograde step as it was so convenient to tweak a GDAL command - which was often necessary as the defaults are often not correct (just now I wanted a Byte output instead of Float32 from a clip process - and now I have to do two steps instead of one). – MappaGnosis Sep 12 '18 at 16:07
  • A shame to see that a year later in QGIS 3.4.2-Madeira I am facing the same problem – Marco Mar 6 '19 at 9:13
3

Disappointing that you can't edit GDAL commands easily in latest QGIS. One option is to use the OSGeo4W shell that installs along with QGIS. You can use that to run GDAL commands directly.

  • Open this from the Start menu: Start > QGIS 3.x > OSGeo4W shell – vinh Oct 15 '19 at 13:43
  • I guess people who install using the QGIS-only installer rather than through OSGeo4W don't have this available, though (I'm not sure). – foobarbecue Oct 15 '19 at 19:56
2

This can be done using Python console.

First copy (or write) a GDAL command and edit in a text viewer. For instance: gdaldem hillshade C:/MyInputFile.tif C:/MyOutputFile.tif -of GTiff -b 1 -z 1.0 -s 1.0 -az 315.0 -alt 45.0 -multidirectional, where we need to delete -az 315.0 (cannot do it in the interface...)

Then open the Python console and type:

import subprocess

cmd = "gdaldem hillshade C:/MyInputFile.tif C:/MyOutputFile.tif -of GTiff -b 1 -z 1.0 -s 1.0 -alt 45.0 -multidirectional"

subprocess.run ([x for x in cmd.split(" ") if x != ""])

Command cmd has to be enclosed with quotation marks " ". Note that you will need to load manually the created file.

I agree that disabling editing of gdal commands is a retrograde step - hope it gets implemented in future versions.

0

A simple and easy to follow user guide for installing GDAL by UCLA Installing GDAL for Windows It is great for running custom GDAL straight from the command prompt.

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.