I want to select points 2 and 3 with a 'selection with expression' in QGIS 3.4. I want to do this by using the buffer function in the expression builder.
I already managed to create a separate buffer and then selecting points that are overlapped by the buffers.
I expect that the expression will select points 2 & 3. The expression buffer( $geometry, 5000)
is not giving the result i expect.
Answer
Unlike the Buffer tool, the buffer
function in the expression builder can only accept a single feature as input. It can't buffer an entire layer. So you'll have to merge all of your church points into a single multipoint feature before you can do this process using the select by expression
tool.
Use the Dissolve tool (processing toolbox) to merge the church points into a new layer with a single multipoint feature.
Assuming that layer is called 'church_points_dissolved', it has an attribute field 'ID', and the only feature in that layer has 'ID' = 0, you can use this expression in the Select by Expression tool to select parking lot points that fall within a specified buffer distance of a church point:
intersects($geometry, geometry(get_feature('church_points_dissolved','ID',0)))
Note: This method is at least as much work as simply creating a separate buffer layer of the church points, and using the Select by Location tool to select parking lot points that intersect the buffer layer.
No comments:
Post a Comment