I am building a Python Scripts for Processing Framework


I know how to make default value when the data type is number or boolean:

##Distance=number 50
##carry_test=boolean True

I also know how to make fields in the layer into a drop down table and let user choose from:

##cal_field=field input_layer

Is there a way to populate a default field as well? Say the layer has the following fields:

fid, name, type, color

Normally everytime the user has to check the drop down to choose 'type'. So it is kind of trouble, is there a way to choose the 'type' everytime when the input_layer has the field 'type'?

  • 1
    Could you be more specific on what you need to populate ? You might need to ask for a new field name, then launch an update on your new field within the code like in here : gis.stackexchange.com/questions/236745/…
    – gisnside
    Apr 18 '17 at 22:50
  • I have edited my question Apr 18 '17 at 22:54

I don't think this is currently possible as at the moment, you can only specify:

##Field=[optional] field [number|string] Parentinput


  • Field - Name of the field parameter in the GUI.
  • [optional] - Optional option to make it...optional.
  • field - The parameter used to list the fields in the layer.
  • [number|string] - Optional filter to only list numeric or string fields in the layer.
  • Parentinput - The layer to read the fields from.

In the more recent processing version, you will also be able to filter date fields but there doesn't to be a method (yet) to allow default values for fields. You can always ask this as a feature request though.

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.