I have a point layer and I'm Looking for a tool which connects every point of the layer with each other. Ideally, I can give a distance and the number of Connections for each point.

The following example is from the ArcGIS tool
enter image description here

In the example each point connects to nine other points which are within distance X Meters.

Is there a tool like that in QGIS or a Plugin or can it be done with the Geometry Generator somehow?


1 Answer 1


Using the distance, you could create a "Virtual Layer" that connects nearby points.

Go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the following query.

Note that the line is created once between 2 points (A-B is the same as B-A).

    make_line(a.geometry, b.geometry) as geometry,
    a.id as fromID,
    b.id as toID
    myPointLayer a
    myPointLayer b
    ON ST_Distance(a.geometry, b.geometry) < 5000
    AND a.id < b.id

enter image description here

  • When I try this the geometry field is null on a shapefile and a geopackage; should this still work for QGIS3?
    – MrKingsley
    Commented Nov 3, 2023 at 11:49
  • 1
    @MrKingsley yes, it is still working. Make sure your layer is point, not multipoint
    – JGH
    Commented Nov 3, 2023 at 12:05

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.