I have two layers, one of points and one of lines. Visually, is something like thise:

enter image description here

As you can see, each line has two points, as it was a graph with vertices and edges.

The properties in the attributes table of the lines are only the IDs, the sames goes for the points.

I tried a Join by location (intersection) and I got somethin like this:

enter image description here

So for each edge (segment) I have two rows, one relating it to a point, the second row connecting it to the other.

What I would like to obtain is having just a single row for each edge, with two related value (so two more columns, not only one), reporting the IDs of the two endpoint of that edge.

  • At least one of those lines is unconnected within the viewfield
    – Vince
    Commented Feb 23 at 17:38
  • Look at the aggregate tool.
    – John
    Commented Feb 23 at 17:45
  • @Vince How that is a helpful comment? that is just a screenshoot of a part of the example
    – Cla
    Commented Feb 23 at 17:52
  • It changes the problem if lines cross each other, and it visually distracts from the problem statement.
    – Vince
    Commented Feb 23 at 17:54
  • ok look only at the table then
    – Cla
    Commented Feb 23 at 17:56

1 Answer 1


In the Field Calculator use:


with layer Line and Point. The Point layer has a field with IDs. The field type for the new field is array. Or you can use string.

enter image description here

Solution 2

You make two fields and for the first you sue this code:

(overlay_intersects('Point', $id))[0]

and for the second you use this code:


Snapping tolerance

If you have problems with snapping the points you can try:

overlay_nearest('Point', $id, max_distance:=0.0001)[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.