If you go to the Census Bureau's website there is a web interface to download Primary, Secondary, and All Roads (FTP link doesn't appear to be working at the moment). The All Roads option is only available per county. Does a 2016 dataset or web service already exist, free or not, where all these county datasets have already been compiled together?

1 Answer 1


You can "extrapolate" the download links from the source code

See javascript function goDownload()

 function goDownload(directory, filename)
      var URL="getFile.php?year=2016&directory="+directory+"&filename="+filename;

    } // goDownload()

and similar functions goDownloadNational(), goDownloadState(), goDownloadCounty().

You can see also in the source code where these functions are called (about line 4130 in my version)

onClick="javascript:goDownload('PRIMARYROADS', 'tl_2016_us_primaryroads.zip')

So you take these two variables, directory and filename, and generate a complete URL with the values from the dropdown


becomes then


which works (26 MB).

You have to then write a small script that loops over all states and countries and then make a URL based on the formula in each function, and then make the queries 1 by 1 (maybe with a short pause, to not get your IP address blocked)

  • Once you have the list of URLs use "wget" or something similar
    – Grimaldi
    Sep 4, 2017 at 11:06
  • yes - and then share the raw data for the community!
    – philshem
    Sep 4, 2017 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.