1

When I try to run the saga:rastervaluestopoints tool in the QGIS 3.2 Python console it returns the following error (see below). I can't figure out what's going wrong. The tool works when running it straight from the processing toolbox.

CODE:

processing.runAndLoadResults("saga:rastervaluestopoints",
                        {"GRIDS": "input.tif",
                        "NODATA ": True,
                        "TYPE": 1,
                        "SHAPES": "output.shp"})

ERROR MESSAGE:

    Traceback (most recent call last):
  File "C:\PROGRA~1\QGIS3~1.2\apps\Python36\lib\code.py", line 91, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "<string>", line 68, in <module>
  File "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\tools\general.py", line 121, in runAndLoadResults
    return Processing.runAlgorithm(alg, parameters=parameters, onFinish=handleAlgorithmResults, feedback=feedback, context=context)
  File "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\core\Processing.py", line 133, in runAlgorithm
    raise QgsProcessingException(msg)
_core.QgsProcessingException: Error: Missing parameter value for parameter NODATA        .
2

You have a space at the end of your NODATA parameter. Your wrote "NODATA " instead of "NODATA".

Try

processing.runAndLoadResults("saga:rastervaluestopoints",
                        {"GRIDS": "input.tif",
                        "NODATA": True,
                        "TYPE": 1,
                        "SHAPES": "output.shp"})

You should try to open the history of processing after you launched them from the toolbox, so you can copy/paste the given python line.

  • Thanks for your answer! Unfortunately, removing the space after the NODATA parameter still results in the same error. Here is the relevant line from the processing history after using the toolbox successfully: { 'GRIDS' : ['INPUT.tif'], 'NODATA ' : True, 'POLYGONS' : None, 'SHAPES' : 'OUTPUT.shp', 'TYPE' : 1 } I'll continue having a play around with it and update if I figure out something that works. – MarkB23 Nov 22 '18 at 14:06
  • It might be an error in QGIS code source. I'm not sure, but in your QGIS installation path, can you apply this small patch locally github.com/qgis/QGIS/pull/8531 ? – etrimaille Nov 23 '18 at 19:17
  • Great, so it's fixed for the next point release 3.4.3 in December – etrimaille Nov 26 '18 at 14:09

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.