I have two layers:

  • contiguous polygons without properties
  • lines with the name property that overlaps the polygons

I want to get a new layer of joined polygons if they are crossed by the same line and secondly, apply the properties of the line to the underlying polygons

enter image description here

2 Answers 2


Use the "Join Attributes by Location" tool via Vector -> Data Management Tools -> Join Attributes by Location.

For your specific needs, I would suggest starting with the following settings:

enter image description here

  • 1
    I get a good result if I also activate the option in the polygon layer: Advanced Option -> Invalid feature filtering -> Skip
    – stefcud
    Commented Oct 25, 2022 at 19:28

You can achieve this using a "Virtual Layer".

Go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the following query. Modify the name of the layers and feel free to add more line attributes.

You can then persist the layer if you wish.

SELECT ln.name, st_union(p.geometry)
FROM myLineLayer ln
JOIN myPolygonLayer p
  ON st_intersects(p.geometry, ln.geometry)
GROUP BY ln.name --only if multiple line have the same name

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.