The limitation is 18,000 feet from the phone company's central office (C.O.) servicing your neighborhood. The green boxes on the side of the road are just outside plant modules that act like hubs to connect smaller areas to the vicinity's C.O.
Keep in mind, also, that the 18,000-foot limit is not a point-to-point straight line. It is 18,000 feet as the cable runs. All the twists and turns between the C.O. and your home cut down on the distance. Also, the varying guages of cable between the C.O. and home will affect distance and available speed.
Even if you are within the 18,000 feet, there may be certain kinds of electronics along the way that will keep DSL from working (though most phone companies will try to remove these, if possible, in order to make the service available, but it can't always be done, depending on what it is).
Special splitter wiring on the inside of your home may also be required if you are beyond a certain distance, even if you are within the 18,000 feet. (If you have an alarm system on your line, you will require the splitter-wiring, as well.)
Hope this helps!