Missing zipcodes in the US

Skip to first unread message

David Bengoa Rocandio

Mar 4, 2021, 7:26:06 AM3/4/21
to GeoNames

Recently I discovered some US zipcodes are missing in the Geonames database, I wanted to see if there were any more missing zip codes, so I downloaded a list from the USPS website. I then compared it with the Geonames database.

I found about 565 missing, most of them military or USPS headquarters.

There are also Puerto Rico, Guam, or American Samoa zip codes, which can be searched in the Geonames website but they are not in the exported file (why?)

Removing those, leaves us with 13 residential zipcodes which seem to be missing from the Geonames DB. The missing zipcodes are:
11437 46288 55131 66630 72405 72643 75059 75064 89437 90134 97079 97129 97251

I've spot checked them by inputting them in the USPS website here, and they seem to be really missing https://tools.usps.com/zip-code-lookup.htm?citybyzipcode

For reference this are the commands I used:

wget 'https://postalpro.usps.com/storages/2021-03/AREADIST_ZIP5.TXT'
wget 'https://download.geonames.org/export/zip/US.zip'
unzip US.zip

cat AREADIST_ZIP5.TXT | tr -d '\015' | grep -o -P ' \d{5}$' | tr -d ' ' | sort > zipcodes_usps
cat US.txt | awk '{ print $2 }' | sort > zipcodes_geonames
comm -1 -3 zipcodes_geonames zipcodes_usps > usps_not_geonames

cat AREADIST_ZIP5.TXT | grep -P '('$(cat usps_not_geonames | tr '\n' '|')eof')' | grep -v -P '(MILITARY POSTAL SERV|HEADQUARTERS|CARIBBEAN|HONOLULU)'

Reply all
Reply to author
0 new messages