I have lines which I want to output as connected points. So What I would like is:

point  x  y
p1    20 30
p2    30 40
p3    50 40


Line point1 point2
l1   p1     p2
l2   p1     p3

I do not see how to extract this from the line layer I have. I have managed to extract points from these line but as far as I can judge I then lose the information on how to connect all of them (which is NOT simply connecting all points to all points or connecting it to the closest one) There is a specific way they should be connected.

I am quite sure this information could be extracted from QGIS but I do not really know how.

  • 1
    You want to connect p1 with all others? p1-p2 p1-p3 p1-p4 etc?
    – BERA
    Nov 30, 2021 at 13:26
  • no this is just an example. The lines represent paths which can have endpoints and triple junctions.
    – user180146
    Nov 30, 2021 at 13:28
  • Can you add a screenshot showing the data you have with attribute table?
    – BERA
    Nov 30, 2021 at 14:19

1 Answer 1


You could use the algorithm 'extract vertices' to extract the 'points' of the line.

For example: I have a layer with 3 lines

enter image description here

Execute the algorithm 'extract vertices'

This is the result:

enter image description here

Now you can add X and Y to the table using the fieldcalculator:

enter image description here

With this as result:

enter image description here

Meaning of the fields:

  • fid: line-id
  • vertex_index: order of the vertex along the line
  • distance: distance from the previous vertex
  • X: x-coordinate calculated by the fieldcalculator with expression $x
  • Y: y-coordinate calculated by the fieldcalculator with expression $y

If you export the results as a spreadsheet (eg. excel) you can use a pivot-table to reorder the results

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.