Skip to content

Field Calculator

Get attribution of start/endpoint of line

array_first(
    array_remove_all( 
        array_foreach (
            overlay_nearest ('joining_layer',$id, limit:=2),
            if (
                within (
                    geometry (get_feature_by_id ('joining_layer',@element)),
                    buffer (start_point($geometry), 0.001)
                ),
                attribute (get_feature_by_id ('joining_layer',@element), 'name'),
                ''
        )),
        ''
))
array_first(
    array_remove_all( 
        array_foreach (
            overlay_nearest ('joining_layer',$id, limit:=2),
            if (
                within (
                    geometry (get_feature_by_id ('joining_layer',@element)),
                    buffer (end_point($geometry), 0.001)
                ),
                attribute (get_feature_by_id ('joining_layer',@element), 'name'),
                ''
        )),
        ''
))
attribute( 
    get_feature( 
        'joining_layer', 
        'fid', 
        "fid"
    ),
    'position'
)

Credit @Wayne19980