The straightness error of guideway is one of the key indicators of ultra-precision machine, which plays an important role in the machining accuracy of work-piece. In order to measure straightness error of long distance ultra-precision guideway accurately, a splicing measurement for straightness error of guideway using high-precision flat mirror and displacement sensor was proposed in this paper, and the data splicing processing algorithm based on coordinate transformation was studied. Then comparative experiments on splicing measurement and direct measurement of straightness error were carried out on a hydrostatic guideway grinder. The maximum difference between the two measurements was about 0.3μm, which was far less than the straightness error of 5.8μm. The experiment demonstrated the correctness of the proposed splicing measurement method and data processing algorithm. To suppress the influence of straightness error on machining accuracy, a straightness error compensation algorithm based on error rotation transformation and vertical axis position correction was proposed, and the grinding experiment of a plane optics with size of 1400mm×500mm was carried out, whose flatness error after grinding was about 2.98μm. The straightness error of the grinding machine had been well suppressed.