Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • geocoding addresses to US census block groups and automation

    The US Census has a neat online tool that lets you get the census tract and block group codes for up to 10,000 addresses: https://geocoding.geo.census.gov/geo...ressbatch?form
    However, I have 1 million addresses and don't want to do this by hand 100 times. Is there an alternative (free or cheap)? If not, is there a way to automate a somewhat complex data retrieval command in Stata 15.1? It would have to go to the website, click to add a file, and then click to get results.
    Thanks.

  • #2
    Actually, the home of the online tool is at https://geocoding.geo.census.gov and from that page there is are links to PDF and HTML documentation for directly using the "Geocoding Services Web Application Programming Interface (API)" as an alternative to the supplied web forms that front-end the same API.

    The suggestion in the documentation is that – with operating system command-line access to the curl command, which I find is built into macOS, and expect is to be found in other operating systems – a command similar to
    Code:
    curl --form [email protected] --form benchmark=2020 https://geocoding.geo.census.gov/geocoder/locations/addressbatch --output geocoderesult.csv
    would submit localfile.csv and create geocoderesult.csv.

    That is the extent of my knowledge gleaned in the past 15 minutes. Perhaps someone familiar with this will be able to give further advice.

    Comment


    • #3
      Thank you.I'll turn to a librarian I know who is an excellent Python coder and API user for databases. She's likely got the answer, if Stata itself can not do it.

      Comment


      • #4
        Thanks! Got it to work!
        Last edited by Doug Hess; 22 Aug 2021, 12:51.

        Comment

        Working...
        X