Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE][processing] New input type for expressions #3713

Merged
merged 4 commits into from
Nov 11, 2016

Conversation

nyalldawson
Copy link
Collaborator

This adds a new input type for expression inputs. Expression inputs can be linked to a parent layer so that the builder shows the correct fields and layer variables.

It's designed for two use cases:

  1. to be used when an algorithm specifically requires users to enter an expression as an input, eg Select by Expression and Extract by Expression. In this case it has the benefit of showing the expression builder and linking it correctly with the parent layer.

  2. to be potentially used as a replacement input instead of string or number literals in algorithms. Eg - if the simplify algorithm tolerance parameter was replaced with an expression parameter, then this expression would be evaluated for every feature before simplifying that feature. It would allow parameters to be calculated per feature, as opposed to the current approach of calculating
    a parameter once before running the algorithm. It would also mean algorithms like "variable distance buffer" would no longer be needed, as a single "buffer" algorithm could then be used for either a fixed distance, field based, or expression based distance.

This is just a concept for now - if the processing team like this idea then i'll add unit tests + proper expression context handling, and update existing algorithms to suit.

@pcav
Copy link
Member

pcav commented Nov 3, 2016

IMVHO: great idea, thanks.

@alexbruy
Copy link
Contributor

alexbruy commented Nov 3, 2016

I like the idea. Also in future it would be nice to have ability include in expressions numeric outputs from other algorithms and accept strings with formulas.

accept numeric, file and table field inputs in modeler

This allows a non-string parameter to be reused as a string
parameter in contexts where it makes sense.
This adds a new input type for expression inputs. Expression
inputs can be linked to a parent layer so that the builder
shows the correct fields and layer variables.

It's designed for two use cases:

1. to be used when an algorithm specifically requires an expression,
eg Select by Expression and Extract by Expression.

2. to be potentially used as a replacement input instead of string
or number literals in algorithms. Eg - if the simplify algorithm
tolerance parameter was replaced with an expression paremeter, then
this expression would be evaluated for every feature before
simplifying that feature. It would allow parameters to be calculated
per feature, as opposed to the current approach of calculating
a parameter once before running the algorithm. It would also
mean algorithms like "variable distance buffer" would no longer
be needed, as a single "buffer" algorithm could then be used
for either a fixed distance, field based, or expression based
distance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants