Calculate speed limit end points correctly when end points are not first points of their respective links
Reuse functions across link index generation and end point calculation
Extract common functionality between link index generation and end point calculation