The ramp is shaped as a right triangle. One leg is the height of the ramp, the other leg is the horizontal length of the ramp and the hypotenuse is the ramp itself. If x is the horizontal length and the angle is exactly 4.8 degrees, then
tan(4.8)=1.8/x
x=1.8/tan(4.8)
x=21.44 feet
This is the minimum horizontal length. The height can't change, so using a shorter length would increase the angle with the ground beyond 4.8 degrees, and that is not allowed.