Within QGIS, I have a 'cable' layer and within such layer I have the columns 'from' and 'to'. The use of this 'cable' layer demonstrates a real-life cable travelling from one piece of equipment to another.

Say I had a layer called 'equipment' with two point features I want a cable to connect to. These two points are labelled 'Point A' and 'Point B', is there a way to auto-populate two columns in the 'cable' layer to show that the line drawn is starting from 'Point A' and ending at 'Point B'?

I do not use PostgreSQL, this project is a private creation.

  • There isn't any correlation at all between private/non-private project creation and PostgreSQL use. If anything, it's the reverse (since non-free databases are unlikely to be used for personal projects).
    – Vince
    Commented May 13, 2023 at 0:19

1 Answer 1


Create a new field for start- and end point with Field calculator and this expression and replace point with the name of the point layerm name with the name of the attribute field containing the point's name and change start_point to end_point when creating the end point's name:

        overlay_nearest ('point',$id,limit:=2),  -- change point to your layer name
        when intersects (
            start_point($geometry),  -- change to end_point for attribute of end point
            geometry (get_feature_by_id('point',@element))   -- change point to your layer name
        then attribute (get_feature_by_id ('point',@element),'name')   -- change point and name to your layer/field names

enter image description here


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