I have 2 layers containing polylines.

I'd like to establish the closest distance at any point along the line of one layer to the the lines on a different layer. My assumption is that the Nearest Neighbour Analysis doesn't do this.

What is the best way?

  • What is the expected result ? A script, a function, datas, etc. ? For answer, for my part, I need more context. – J. Monticolo Feb 10 at 9:51
  • @J.Monticolo I have a layer with a network of polylines most of which are surplus to my requirements. I only need to work with ones that are within a certain proximity to the lines on my other layer. I had hoped to created a distance field that I can use to help delete the lines not required... Hope that makes sense. – Mardymonkey Feb 10 at 10:06

you can do this very easy with QGIS virtual layers with a definition like this:

select layer1.* from layer1, layer2 where st_intersects(st_buffer(layer1.geometry, 500), layer2.geometry)

This will select all lines from layer1 which are in a distance from 500 (meters) to any geometry from layer2 and put the result into a new virtual layer.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.