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

Expression function "feature_id()" #51116

Closed
andreasneumann opened this issue Dec 5, 2022 · 0 comments · Fixed by #51441
Closed

Expression function "feature_id()" #51116

andreasneumann opened this issue Dec 5, 2022 · 0 comments · Fixed by #51441
Labels
Expressions Related to the QGIS expression engine or specific expression functions Feature Request

Comments

@andreasneumann
Copy link
Member

Feature description

A new expression function feature_id() would be useful in order to get the internal id of a certain feature in another (related) layer.

As parameters, there could be different variations, e.g.:

feature_id(layer,pkey_value)

assuming that the other layer knows which column contains the pkey.

or

feature_id(layer,pkey_column,pkey_value)

if the layer doesn't know the pkey column name.

or

feature_id(feature)

not sure if it is possible? A feature might not be unique, even if it contains a geometry?

Additional context

This is useful when working on expressions with multiple related layers. There are some expressions that require the "internal feature id" as an input parameter.

@andreasneumann andreasneumann added Feature Request Expressions Related to the QGIS expression engine or specific expression functions labels Dec 5, 2022
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Jan 11, 2023
Allows for retrieving the feature ID of a feature object. Accepts
one argument which must be a feature object. Accordingly this
function can be used with the results of any other function
which returns feature objects, such as "get_feature", "overlay_*",
etc.

Fixes qgis#51116
nyalldawson added a commit that referenced this issue Jan 13, 2023
Allows for retrieving the feature ID of a feature object. Accepts
one argument which must be a feature object. Accordingly this
function can be used with the results of any other function
which returns feature objects, such as "get_feature", "overlay_*",
etc.

Fixes #51116
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expressions Related to the QGIS expression engine or specific expression functions Feature Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant