I'd like to do a regression analysis of magnetic susceptibility measurements taken at several sample points to a nearby road. The purpose is to see if proximity to the road correlates with higher magnetic susceptibility. For this to work I need to know how far each point is from the road. I've added a vector line over the road to provide something to measure against. Can anyone recommend how I should proceed from here. Ideally I'd like something that will measure all of the points en mass as it would be tedious to measure each one individually. I tried the distance matrix but it can only measure the relationship between points, not between points and a line.

1 Answer 1


Your measurements are a point layer, if I understood correctly. Create a new attribute on this layer with Field Calculator with this expression and replace line_layer with the name of the line layer. The expression looks for each point which is the nearest line on the layer line_layer, then identifies the cosest point on this line and returns the length measurement to the current point:

        overlay_nearest ('Output least cost path',$geometry)[0],

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.