Road vehicle lateral positioning is a key aspect of many assistance applications and autonomous driving. However, conventional GNSS-based positioning systems and fusion with inertial systems are not able to achieve these levels of accuracy under real traffic conditions. Onboard perception systems provide knowledge of the surroundings of the vehicle, and some algorithms have been proposed to detect road boundaries and lane lines. This information could be used to locate the vehicle in the lane. However, most proposed algorithms are quite partial and do not take advantage of a complete knowledge of the road section. This paper proposes an integrated approach to the two tasks that provides a higher level of robustness of results: road boundaries detection and lane lines detection. Furthermore, the algorithm is not restricted to certain scenarios such as the detection of curbs; it could be also used in off-road tracks. The functions have been tested in real environments and their capabilities for autonomous driving have been verified. The algorithm is ready to be merged with digital map information; this development would improve results accuracy.