I created a model in QGIS 3.6 with three inputs parameters (two vector layer and one vector field). When I run the model, the inputs are not sorted in a correct way: the vector field is requested before the vector layer.

For this simple example, it doesn't matter, however for more complex models with severals inputs, I fear the user could feel not confortable.

Is it possible to choose the order of the inputs parameters ?

Here are two screenshot. "Conduite" = pipe in french "regard" = manhole in french

I want the user to select firstly "regard" layer, then "ID_regard" field within "regard" layer.

enter image description here

enter image description here


If you right-click your model and select the Export Model as Python Algorithm, you would get a translated script of your model. Here you could order the parameters however you like in the initAlgorithm() function. E.g.:

def initAlgorithm(self, config=None):
    self.addParameter(QgsProcessingParameterFeatureSource('1conduites', '1_Conduites', types=[QgsProcessing.TypeVectorLine], defaultValue=None))
    self.addParameter(QgsProcessingParameterVectorLayer('2regard', '2_Regard', types=[QgsProcessing.TypeVectorPoint], defaultValue=None))
    self.addParameter(QgsProcessingParameterFeatureSource('3idregard', '3_ID_regard', types=[QgsProcessing.TypeVector], defaultValue=None)) 
    self.addParameter(QgsProcessingParameterFeatureSink('Result', 'result', type=QgsProcessing.TypeVectorPolygon, createByDefault=True, defaultValue=None))

Then save and run your script which should list the parameters in the same order as in the script. This method means you need to run the script version instead of the model version but the interface is exactly the same.

| improve this answer | |

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.