I have an quite complicated polygon shapefile and a lot buffers around points (second shapefile).

These small polygons are within and outside of the big polygon. I need to select those polygons which touch the boarder(line) of the big polygon, no matter if the are outside or inside of it.

I found this solution for PostGIS (How do I select points within a specified distance of a polygon's border?), but the query can't be used in QGIS.

I tried out all of the "Select by location" options in QGIS, but intersect only selects those that are within the polygons and 'disjoint' those that are outside of the polygons.

The buffers were only created in order to get the points with a certain distance to the polygons boarder, that's why also a query using a distance and the points would work.

I think this expression from PostGIS should be reformulated for QGIS:

FROM point
JOIN boundary
    ON ST_DWithin(point.the_geom, boundary.geom_boundary, 100)

I’ve never used the "Select by Expression" function.

the points sourrended with the blue pen are those tobe selected

2 Answers 2


You can use "Select by expression" via QGIS's Processing Toolbox (Ctrl+Alt+T) or attribute table (F6). Run it on your points layer and use this expression:

    ) < 5000

This way you don't need to create the boundaries of your polygons as new layer. Adjust the name of the polygon layer and the maximum distance.

  • This selects also points in-/outside the polygon. As far as I understood OP wants only points that touch the polygon's boundary. So using overlay_touches would be probably better and easier.
    – Babel
    May 11, 2022 at 5:29
  • It seems we look at different questions, then - I can't find the "or lie within a certain distance to it" part in OP's question....? Not in the version here and not in an edited earlier version.
    – Babel
    May 11, 2022 at 7:16
  • 1
    OK, I see. The question is a bit confusing...
    – Babel
    May 11, 2022 at 7:42
  1. Convert your polygons to lines
  2. Select by location, the buffers intersecting the lines (or Select within distance, your title says points but question body says polygons)

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.