I'm looking for a way to only select entities crossed by a lines layer from a polygons layer. I've unsuccessfully tried the Intersect function with lines layer overlay. I'm mentioning that I have used the same CRS for both layers. Here what I want to do in the pictures:

Polygons layer crossed by a lines layer:

area of interest

The highlighted area I want to extract:

expected result


3 Answers 3


Run "Select by location" from your Processing Toolbox and choose your polygonlayer as 'Select features from', your linelayer as 'By comparing to the features from' and intersect as 'geometric predicate'. Your layers do not need to be in the same CRS, that is not an issue.

enter image description here

If you want to extract these features. You can run "Extract by location" instead of "Select by location".

  • It worked as expected. Then I simply saved selected features
    – Caligraphy
    Mar 29, 2021 at 14:33
  • @Caligraphy or run "Extract by location". This will create a new layer containing only the features you want.
    – MrXsquared
    Mar 29, 2021 at 14:35

There is a possibility of using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume there two layers, a line layer 'lines' and a polygon layer 'polygons'.


With the following query, it is possible to extract polygons from a layer crossed by a lines layer.

FROM "polygons" AS p, "lines" AS l
WHERE st_intersects(p.geometry, l.geometry)

The output polygon layer (yellow) with its attribute table will look like



And a third solution: use QGIS expressions with geometry generator (for visualization purpose only, but it dynamically updates when you change the existing line) or Menu Processing / Toolbox / Geometry by expression to create actual geometries. In both cases apply the following expression on the line layer (and change polygon to the name of your polygon layer):

collect_geometries ( 

Remark: overlay_disjoint is available since QGIS 3.16.

Screenshot: layer polygon in blue, layer line with red line and with dynamically generated yellow polygons, corresponding to those you want to keep: enter image description here

  • Brilliant solution and new functionnality. I will try as soon as 3.10 is no longer LT version.
    – Caligraphy
    Mar 29, 2021 at 14:38
  • 3.16 has replaced 3.10 as new LTR last month: qgis.org/en/site
    – Babel
    Mar 29, 2021 at 15:18

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.