[QGIS-Developer] Processing 3.0: Using expressions instead of fields and values where possible

Nyall Dawson nyall.dawson at gmail.com
Mon Jul 24 03:25:30 PDT 2017


On 24 July 2017 at 18:25, Alexander Bruy <alexander.bruy at gmail.com> wrote:
> One of the improvements in Processing is support for expressions-based
> parameters. But from what I can see this new feature is not widely adopted in
> algorithms. For example, algorithms such as SetZValue, SetMValue and many
> others still use numeric or field parameters while using expressions
> will give them
> more flexibility, e.g. taking values from field, formulas etc.
>
> Should we rethink this and move to expressions-based parameters
> where possible now when number of adopted algorithms is relatively small?
>

It'd definitely be a good move. Some related thoughts:

- It's not something which has to be done before 3.0 - it's possible
to flip this at a later stage without breaking any API or existing
models
- It's not currently exposed in any way to the GUI. But again, we
could add that at a later stage and still adapt the algorithms now.
- I think we should add a new flag to parameters to indicate support
for this. Something like FlagSupportsDynamic. The gui could use the
presence of this flag to decide to add a "data defined override" style
button next to the widget to allow setting the parameter to a
field/expression.
- Models also now support "precalculated" expression values, which are
evaluated just before each algorithm step in the model runs. That's
also not exposed in the GUI, but there's nothing required on the
backend or algs for this to be supported. This needs
https://github.com/qgis/QGIS-Enhancement-Proposals/issues/84 to be
implemented in order for it to be accessible through the UI.

Nyall


More information about the QGIS-Developer mailing list