Automatically assigning attribute to line features
It is a long process but doable without programming:
- dissolve your lines (no multiparts)
- derive end points and delete overlapping
- spatially join end points (1:m) and count number of lines connected to node:
- buffer ones with count of 3 and intersect with original lines
- dissolve intersect to multipart lines using buffer fid
- derive ends of multipart lines and remove ones that intersect original nodes
- convert points to line (close line) using relevant field to form a line:
- create polygons from closed lines. This is a key, because polygons are made of clockwise points (!)
- assign unique ID to each polygon and split it at vertices
- compute their length, sort ascending by length and remove duplicates of polygon ID.
Start of remaining segment intersect left leg at fork, end of it sits on right leg: