3

I am trying to resample two raster layers with Python console in QGIS with this code:

outputs_0=Processing.runAlgorithm("saga:resampling", 'G:/DOCTORAT/2014/Incendis/Dades/LST/LST_TERRA/Tiff/2012/UTM30N/2012153_day.tif', True, 0, 0, 0, "-81084.51, 1138915.49, 3972094.6, 4861094.6", 1000.0, 'G:/DOCTORAT/2014/Incendis/Dades/LST/LST_TERRA/Tiff/2012/FINALS/2012153_day_FINAL.tif')

I got this:

Error: Wrong number of parameters

However, it seems to contain all needed parameters:

INPUT <ParameterRaster>
KEEP_TYPE <ParameterBoolean>
TARGET <ParameterSelection>
SCALE_UP_METHOD <ParameterSelection>
SCALE_DOWN_METHOD <ParameterSelection>
OUTPUT_EXTENT <ParameterExtent>
USER_SIZE <ParameterNumber>
USER_GRID <OutputRaster>

Someone could please help me?

2
  • Does it work fine if you run it via the GUI (Processing Toolbox)?
    – Joseph
    Commented Jul 2, 2014 at 12:54
  • Yes, it works correctly this way :-)
    – user33045
    Commented Jul 2, 2014 at 18:59

1 Answer 1

1

Another method is to use Model Builder via the Processing Toolbox:

  • Create a model to run the SAGA:Resampling algorithm with all the required parameters
  • Save the model (make sure to add a model name and group name in the text boxes)
  • Exit the Model Builder and you should see your saved model in the list under the group name you provided (Processing Toolbox > Models > (group name)
  • Right-click on the model and select to Save as Python script

Now you can see what the python script should be and compare it with what you had to see where you went wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.