I'm working with QGIS 3.12 and have two large point shapefiles (buildings/barns and wetlands) that I want to connect with lines via the geometry generator. I've found a function called get_feature() that will connect the points in the correct way but the get_feature() function only selects the first in a one to many relationship.

See example screenshot. The blue wetland dot is only connecting to one of the four building dots.

The script I have currently is:

make_line(    geometry(get_feature('barns', 'wID', '3809' ))  ,  geometry(get_feature('wetland_matrix', 'InputID', '3809' ))      )

I need to connect all four, not just the one!

example of selection

  • I think you need to define a relation firstly. Once the relation is defined you will need to try your expression with a relation aggregate. I am not near a computer to test this Nov 14, 2020 at 16:53

1 Answer 1


From your question, it seems like your barns and wetlands have a matching ID field (wID and inputID) and a N (barns) to 1 (wetlands) relationship. If so, you can do it easily, by setting up a geometry generator style on your barns (point) layer:


enter image description here

enter image description here

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.