I have a line layer containing sections of paths. Sections with the same ID (WID) form a hiking trail. Many of these trails are circular routes, which often have access/exit paths starting from a parking lot. I want to create a sort of "route book" using the QGIS Atlas, with the hiking trails (not the individual sections) serving as coverage layers. On each atlas page, I would like to display the length of the main route and the length of the access/exit paths or sub-routes.
I can create the atlas features for the hiking trails using a virtual layer and the ST_Union function (group by WID), but then I cannot access the access/exit paths or sub-routes anymore. How can I display the length of the main route and the sub-routes for each complete hiking trail on each atlas page?