Transfer attributes from one line to the next point

Hello everyone,

I recently managed to integrate an expression into QFIELD here in the forum.
 It examines all my lines (road segments) and, given my position, 
adopts the distance (station) of the section of the street when saving the point. 
I'm satisfied. Now I also want to adopt two attributes from the line,
 but I can't seem to get it to work. 
So, I could add another command to the expression, and then it would be, 
since it points directly to the line. 
I'll add the expression; perhaps someone can help me.


--------------------------------------------

with_variable(
'current', $geometry,
with_variable(
'line_layer', 'Snetz',
with_variable(
'line',
line_merge(
array_first(
aggregate(
@line_layer,
'array_agg',
$geometry,
order_by := distance($geometry, @current)
)
)
),
if(
is_empty_or_null(@line),
NULL,
line_locate_point(@line, closest_point(@line, @current))
)
)
)
)

I have solved it with the exprression “overlay_nearest” →

array_first(overlay_nearest(‘Line_Layer’, “Attribute”))

:grinning_face_with_smiling_eyes:

can be helpful for somebody…

3 Likes

THanks a lot - this is great and I will add it to my list of Code Snippets.