I wanted a database of all zip codes in the country, with their lat & long. And I wanted it to be easy to import and easy to update.
I found this gist, which was great and did most of the hard work, but I wanted to:
- Put the scripts in a single location
- Have the database in dolthub for easy querying, updating, and sharing
- Be able to easily update the zip code data
- JSON
- CSV
- CSV with PK ID
- SQL (mysql dialect)
Where did this data come from?
- https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.html
- "ZIP Code Tabulation Areas"
This is documented in the bin/download-gazetteer
script.
The data is available on Dolthub here:
https://www.dolthub.com/repositories/iloveitaly/zip_codes_with_lat_and_lng
- Update download URL in `bin/download-gazetteer
- Run
bin/download-gazetteer
- Profit