Friday, 14 September 2018

pyqgis - What is the new alglist and alghelp in QGIS 3.0 Processing?


Accessing the new QGIS 3.0 processing scripts through the Python console is proving to be a challenge for me, especially since the old processing.alglist() and processing.alghelp() commands appear to be defunct.



  • How does one call up a list of processing scripts?

  • How does one call up the help info for an individual script?



Answer






  • How does one call up a list of processing scripts?


    QgsApplication.processingRegistry().algorithms()

    If you want to print a readable list of algorithm ids and names, you can do this:


    for alg in QgsApplication.processingRegistry().algorithms():
    print("{}:{} --> {}".format(alg.provider().name(), alg.name(), alg.displayName()))



  • How does one call up the help info for an individual script?


    processing.algorithmHelp("qgis:refactorfields")


See https://qgis.org/api/api_break.html#qgis_api_break_3_0_Processing for details and recommendations from QGIS developers.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...