I need to relate text values (annotations) to lines. In the example bellow, there are 3 lines and 2 annotations. The longest line (two segments) should get value "PEd100" and the other one should get PE32. Annotations aren't related to lines by common attribute, just placed near the lines.
In this case both geometry and annotations are on the same layer, but it's not always the case. Any ideas?