-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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][expression] refFunction port to core #38405
Conversation
…equals and touches
# Conflicts: # src/core/expression/qgsexpressionfunction.cpp
@olivierdalang A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
@olivierdalang |
I tried these new functions in QGIS 3.16, but they don't seem to work. I am needing to keep the refFunction plugin for now.
|
@M-Rick Thanks for reporting your issue ! Could you please open a new issue instead, so we can better keep track of it ? Also don't forget to add data and exact steps to reproduce the issue. Ping me in the issue ( |
This is not the correct syntax of the new function. It should be |
@DelazJ after a quick test it does not seems to work anyway (the equivalent from the plugin works). |
@gioman could you share the expression you tested and the context (ref comment above about array output), please? |
@pigreco with double quotes preview works, but then values are not saved to the target table/column. |
it is normal because they are arrays, if you want to save them you have to define the new field as text and use the expression
or if you just want an array value
|
@pigreco ok I see. I little less convenient than the original function. |
@gioman I meant "no need of quotes to have the expression return results. Ie, |
actually I tried to extract a number and put it into a integer field, and it also do not work (also because extracting from polygons with points, so only 1 value is extracted). |
Even if only 1 value is extracted it will be an array ( |
ok. Should we add this in the function help? |
Improving the function help would be very nice 👍 |
@m-kuhn after thinking about I'm not sure how is best to do that, after all is normal that in any function that returns an array, an array function must be used too... Maybe adding a general note if is not already there (can't find one, but docs are very large nowadays!)? @DelazJ |
Maybe we could add it to the expression builder dialog, where we know it's an array (and we do some magic to convert it to a string already).
|
sounds good to me. |
@gioman array functions are referenced at https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/functions_list.html#array-functions. |
Description
This PR ports the refFunction plugin to core. RefFunctions are spatial operators expressions, allowing to make spatial queries on other layers from withing expressions, opening up a lot of really powerful workflows.
The hard work was done by @enricofer (the author of the plugin) and @m-kuhn , this is a rebase and polishing of their work.
The following new expression functions are implemented :
They all work in the same way : the spatial operator is evaluated against the other layer. If an expression is provided, it returns an array of results. If no expression is provided, it returns a boolean telling whether at least one feature matched.
Features can optionally be filtered by an expression, and optionally be limited to a certain count.
The
geometry_overlay_nearest
has an additional max_distance filter.I'll leave this PR as a draft for some time as I still need to test it a little more and there's some more optimisation that can be done.