Skip to main content
1 of 5
Bera
  • 77.8k
  • 14
  • 78
  • 188

You can use SQL to create a virtual layer.

select  row_number() over() as new_id, 
        a.id as a_id, 
        b.id as b_id, 
        setsrid( make_line(a.geometry, b.geometry), 3006) as geometry
from myPoints as a
join myPoints as b
on st_distance(a.geometry, b.geometry)<10000
where a.id<b.id

The query joins the layer to itself where there are other point within 10000 distance units, where their ids are different, then creates a line between them.

You need a unique id column, my is named id. Replace id in a.id and b.id with the name of your id column. Replace 3006 with your coordinate system code, myPoints with your point layer name, and 10000 with the max distance you want to search for neighbor points.

enter image description here

Bera
  • 77.8k
  • 14
  • 78
  • 188