Geographic Information Systems Asked on December 1, 2020
Using QGIS 3 graphical modeler I created a model with a variety of input parameters (> 10). When starting the model, a nice user interface is generated. But the arrangement of the GUI elements is totally confused and apparently unpredictable during creating the model. It does neither seem to depend on the arrangement of input parameters in the graphical modeler nor on the chronological order in which the input parameters are added to the model.
Is there a way that let’s me arrange the GUI elements in the order I desire?
Since QGIS 3.14 this is now possible using the Reorder Model Inputs...
button at the bottom of the Inputs panel:
Correct answer by pathmapper on December 1, 2020
Not as of QGIS 3.4 -- the order is always quasi-random.
Answered by ndawson on December 1, 2020
Since QGIS 3.6 processing models can be exported as python algorithms (right click on the model):
This opens the resulting processing algorithm in the script editor.
The order of gui elements is defined in the method initAlgorithm()
:
from qgis.core import QgsProcessingParameterEnum
from qgis.core import QgsProcessingParameterFeatureSink
from qgis.core import QgsProcessingParameterVectorDestination
import processing
class BbbbProcessor(QgsProcessingAlgorithm):
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterField('1formelfradrschlssel', ...
self.addParameter(QgsProcessingParameterField('2formelfradressschlsselversorger', ...
self.addParameter(QgsProcessingParameterField('3testaufkderschlossen', ...
self.addParameter(QgsProcessingParameterVectorLayer('adr', ...
self.addParameter(QgsProcessingParameterString('adrneinderschlflst', ...
...
The desired order of gui elements can be achieved by simply re-ordering the self.addParameter()
method calls.
Note that this is more a workaround, since it hae to be done any time parameters change. If on the other hand only the process itself is changed and not the parameters, one may simply copy and paste the initAlgorithm()
method.
Answered by Jochen Schwarze on December 1, 2020
Yes, there is a way.
when you set a new Input element, the name you give to it is like an ID. So, add an input and call it '0', it´ll be the first to be displayed, after you hit OK, it´s possible to change the name to any word, and the pseudo ID continuos to be '0'. So the next input should be '1', hit OK, change the name and so on.
the order QGIS create is based on numerical and alphabetic ascending order.
In that way I could rearrange a model with 9 inputs with no problem. I only needed to re-Add all the inputs to be in the order I wanted.
Answered by Herbert Santos on December 1, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP