With QGIS 3.28 I have a point layer (boreholes) . And I have a polygonal layer (departments/districts). My goal would be to via QGIS (right click boreholes point layer -> attributes form) to automatically fill the "department" field of the boreholes layer. The filling would be done via spatial intersection. The field of the departments table that I would like to retrieve is called "nom_dep".

I am attaching a screenshot of my settings. enter image description here For the "layer" parameter, I filled the department layer For the "key column" parameter, I entered the primary key (gid) of the department column For the parameter column of values, I put the field "nom_dep" from the table of departments

I didn't fill in anything for the "Column description" parameter.

In the "Filter expression" section I filled like that:

filter:=intersects(geometry(@parent), $geometry))

I have no error message. But it does not work. I do not see the values of departments entered in the field of the table of boreholes. Did I make a mistake? Should another QGIS filter expression be used?

1 Answer 1


When you are in the Value Relation filter expression box the frame of reference/scope is actually that layer (i.e. your departments layer) - so for example $geometry returns a polygon geometry rather than any point geometry (or lack of geometry) from your point layer.

So you shouldn't need to use an extensive aggregate() function.

To extract any values from your currently edited feature (i.e. your borehole layer), you instead need to use the variables provided such as @current_feature.

Try the following, which should filter your departments layer by just checking whether each department's geometry intersects with the borehole point you've just digitised, and returning the matching features only.

intersects($geometry, @current_geometry)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.