How to select points within a certain distance from a line?

How to select points within a certain distance from a line?

I have a file with a points layer and a lines layer. I would like to select only the points that lay within certain distance (a couple of meters) of the lines.

Is there an easy way to do this?

Or should I create a new polygone layer wich forms a kind of buffer around te lines and then use the select bij location tool?

How can I create such a layer?

I am not sure if you are using ArcGIS or not but if you are and I dont know if this is the most ideal answer but yes, run the buffer tool and create a buffer around your line at whatever distance you want. Then run the select by spatial location and select all points that are completely contained by the newly created buffer layer. This will give you the answer you are looking for

I strongly suggest the method mentioned by yourself and @user3338197 as it's probably the simplest.

Another method to calculate the distance from a point to its nearest line involves first having to convert your line layer to points using Convert lines to points from SAGA (in the Processing Toolbox). Select Yes for the Insert Additional Points option and use a very low value for the Insert Distance (such as 0.01, note that this is measured in metres). This adds a point every 0.01 m so the lower this value is, the more accurate you will be when finding the nearest distance.

Now you can use the Distance to nearest hub tool which calculates the distance (in metres, feet, layer units etc.) from a source to the destination layer.

You will have the option of exporting another point shapefile which will have an attribute containing the distances of each point to its nearest line:

You can then use the Field Calculator or Select by expression tool to only show/select points within x metres:

"HubDist" < x

Hope this helps!