To put swansont's post into math:
An object of length [math]L[/math] is located at distance [math]d[/math] from its frame of reference. So , its extent is [math][d, d+L][/math].
In another frame, moving at speed [math]v[/math] wrt the object, its extent is given by the Lorentz transforms, so the extent is:
[math][d \sqrt{1-(v/c)^2}, (d+L) \sqrt{1-(v/c)^2}][/math].
So, the object distance to the origin of the system of coordinates contracts just as its length.
A train can be described as:
[math][(d_1, d_1+L_1),(d_2, d_2+L_2)][/math] in its co-moving frame. In the moving frame, the train is described as:
[math][(d_1, d_1+L_1)\sqrt{1-(v/c)^2},(d_2, d_2+L_2)\sqrt{1-(v/c)^2}][/math]