Wednesday 25 September 2019

pyqgis - QGIS Python Scripting - Syntax definition


After playing around with the QGIS Modeler and looking at the python scripts of what I make, I noticed some syntax which I can't find the definition anywhere. Here is a snippet of the python script from a model:


outputs_13=processing.runalg("qgis:fieldcalculator", outputs_12['SAVENAME'], ID, 1, 10, 0, True, $rownum , None)
outputs_14=processing.runalg("qgis:deletecolumn", outputs_13['OUTPUT_LAYER'], longitude, None)
outputs_15=processing.runalg("qgis:deletecolumn", outputs_14['SAVENAME'], latitude, savename_alg15)
outputs_16=processing.runalg("qgis:clip", outputs_15['SAVENAME'], vectorlayer_layer1, None)
outputs_17=processing.runalg("qgis:fieldcalculator", outputs_16['OUTPUT'], Score, 0, 10, 0, True, 2, output_layer_alg17)

Can someone please explain the purpose of ['SAVENAME'], ['OUTPUT'] and ['OUTPUT_LAYER']?


I am trying to develop a script but keep getting errors linked to these terms and I am unsure as to how they are used.




Answer



Look at Using processing algorithms from the console


import processing 
processing.alghelp("qgis:fieldcalculator")
ALGORITHM: Field calculator
INPUT_LAYER
FIELD_NAME
FIELD_TYPE
FIELD_LENGTH
FIELD_PRECISION

NEW_FIELD
FORMULA
OUTPUT_LAYER

FIELD_TYPE(Field type)
0 - Float
1 - Integer
2 - String
3 - Date
processing.alghelp("qgis:deletecolumn")

ALGORITHM: Delete column
LAYERNAME
COLUMN
SAVENAME
...

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...