11

I try to create a common extent for rasters in QGIS 2.99. Here is my script:

import processing

processing.runalg("script:unifyextentandresolution",
                  "/qgis_data/rasters/Image2.tif;
                  /qgis_data/rasters/Image1.tif",
                 -9999,"/qgis_data/rasters",True)

However, processing.runalg is being used for QGIS 2.99. I need it for QGIS 2.99

1 Answer 1

19

You need to use:

processing.run()

which is the equivalent to the QGIS <= 2.18 version:

processing.runalg()

I'm not sure how you created your input parameters in your script but I used the following dictionary format for a simple script (change the PARAMETER_X names with the ones you used:

import processing
parameters = {'PARAMETER_1': "/qgis_data/rasters/Image2.tif; /qgis_data/rasters/Image1.tif",
                'PARAMETER_2': -9999,
                'PARAMETER_3': "/qgis_data/rasters",
                'PARAMETER_4': True}

processing.run('script:unifyextentandresolution', parameters)
7
  • 2
    I also know that 'alghelp' processing method changed to 'algorithmHelp' but, do you know what is equivalent method to 'alglist'? I tried it out some posible candidates but it didn't work (they are not callable). Thanks in advance.
    – xunilk
    Nov 26, 2017 at 18:19
  • 1
    Joseph, thanks a lot but as a new question would be marked as duplicated because answer I'm looking for is in your link post (+1 for you there).
    – xunilk
    Nov 27, 2017 at 13:21
  • 1
    I posted an answer in your link post for complementing yours because dir(processing.algs.qgis) and dir(processing.algs.gdal) have some issues (all methods names are listed with some uppercase letters and they need to be expressed with all letters lowercase).
    – xunilk
    Nov 27, 2017 at 15:02
  • 1
    @xunilk - I noticed your answer (already upvoted it) and glad you posted a nice method to getting all algorithms, not necessarily just for qgis ;)
    – Joseph
    Nov 27, 2017 at 15:04
  • 1
    Thanks. I'll update for saga too. By the way, you are right when you say that you can't confirm if all algorithms listed are present. I know that 'saga:rastercalculator' is present and it's not listed yet.
    – xunilk
    Nov 27, 2017 at 15:44

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.