6 ms·
For those that may be interested, this is my project to easily get a list of every zipcode + city/state combo. It is available as JSON you can easily directly w
by pseudosavant 1y ago
For those that may be interested, this is my project to easily get a list of every zipcode + city/state combo. It is available as JSON you can easily directly work with, or even try a service like this: https://usps-zip-codes.deno.dev/90210 https://usps-zip-codes.deno.dev/90210.
I have a pet peeve for having to enter my zip code after I've already had to type in the city and state. There wasn't any easily downloadable file that had every ZIP code though. I keep hoping more sites will ask for ZIP first and then just auto fill it using data like this. /wishfulthinking
https://github.com/pseudosavant/usps-zip-codes https://github.com/pseudosavant/usps-zip-codes
- jayknight 1y agoIt doesn't contain my zipcode/city combination. My zip code spans across a city line, and the json file only has the OTHER city in it.
- pseudosavant 1y agoFor what it is worth, this is the ZIP code data as according to the USPS. The scripts simply create the JSON file for you by calling the USPS API for every zip code between 00000 and 99999 (plenty of holes in there) and recording the response if there is one.
- dfxm12 1y agoI have a pet peeve for having to enter my zip code after I've already had to type in the city and state. What else would you expect? Typing my zip is way easier than going through a list of zipcodes in a dropdown, many of which will be off by one digit in different spots. (ETA: I reread your comment and see what you are expecting) I like the experience of autocomplete while I'm typing out my street address.
- boilerupnc 1y agoI think the sentiment for the pet peeve is commentary on the perceived inefficient sequence of the data input and a hope for reducing the number of fields entered from 3 to 1. >I have a pet peeve for having to enter my zip code AFTER I've already had to type in the city and state. The city and state can be derived from the zipcode - so why not simply ask for the zipcode to be typed and then auto-populate the associated city and state.
- dfxm12 1y agoThe city and state can be derived from the zipcode A few comments here suggest this isn't true. If you want to reduce input to one field, the autocomplete based on the street address that I brought up is the best experience I've come across.
- shagmin 1y agoI'm in a zip code that spans two cities and I can think of other ways it gets complicated in different scenarios. There are places where I can throw a ball across multiple zip codes, sales tax jurisdictions, municipal lines, county lines, etc., with varying degrees of overlap. The problem I've anecdotally seen with autocomplete is there's another property with the same street address as mine but in a different city and different zip code (granted only last digit is different IIRC) about ~15 miles away and on more than one occasion it's caused a few mix-ups.
- cwmma 1y agoThere are multiple zip codes in my state (Massachusetts) that cover multiple towns some examples include 01002 which is Pelham and much of Amherst, 01027 which is both Easthampton and Westhampton (different towns) etc.
- pseudosavant 1y agoThanks for the heads up. It definitely used to include the 0xxxx ZIP codes. It is supposed to just naively fetch everything between 00000 and 99999 and record the USPS response. I'll have to re-run it and update it.
- jandrewrogers 1y ago> The city and state can be derived from the zipcode False. Some ZIP codes even cover multiple States.
- pseudosavant 1y agoI like the autocomplete too. Probably the best pattern, but it does usually do that by leveraging paid Google Maps APIs I believe. I was frustrated that this seemingly open data wasn't openly available. Anything that asks for city+state+zipcode can ask for zip code first, auto populate the rest. For the edge cases where the city is wrong, the person can still type in the city like they would have needed to anyway. It is worth noting that a package would never get delivered to the wrong place because the city wasn't correct but the ZIP code was. The USPS routes based on ZIP codes, not city/state.
- deleted 1y ago[deleted]
- uptown 1y agoYour list is very incomplete. It seems to be missing all zip codes with a leading zero.
- stackskipton 1y agoSomeone who deals with this, reason you type in the Zip Code is its rudimentary checksum to make sure someone put in right information. > There wasn't any easily downloadable file that had every ZIP code though Post Service says what? https://postalpro.usps.com/ZIP_Locale_Detail https://postalpro.usps.com/ZIP_Locale_Detail (Heads up, it's Excel document)
- pseudosavant 1y agoNice find! Looks like something they recently added. Before I made this project I was looking for exactly something like that and I couldn't find it anywhere.
- xnx 1y agoThat page has been there 2021.
- pseudosavant 1y agoI first made this script in 2017, so recent is a relative term I guess.
- deleted 1y ago[deleted]
- Spooky23 1y agoThe only gotcha with the zip code reverse lookup is that there is a many to one relationship between city and zip. Look at Albany, NY (12201-12209) in the list you posted. There are a few with two cities, and iirc there are at least 3 other acceptable cities for 12203 that aren’t listed in that source.
- stackskipton 1y agoON systems I work with, we run entire Street, City, State into Zip code lookup and compare with Zip code provided. If it's within postal code, we may present it to be corrected. If it's way off, we say "Umm, something is way off here, please try again." and flag it for fraud check.
- sib 1y agoI'm a little confused by your peeve: There are ZIP codes that represent more than one city (town) - and that cross state boundaries. And there are cities (towns) that have more than one ZIP code.
- GuinansEyebrows 1y agoi prefer my device to autofill data i've chosen to save for that purpose into a dumb form 99% of the time over the "start typing your address to locate..." functionality i see on checkout screens these days. maybe someday when they're faster/more transparent, sure, but for now the functionality you reference exists and is not great.
- pseudosavant 1y agoThanks for the heads up on the newer https://postalpro.usps.com/ZIP_Locale_Detail https://postalpro.usps.com/ZIP_Locale_Detail file. I converted my script over to being a Python script that uses ZIP_Locale_Detail.xlsx as the source and doesn't require API access anymore. My new file contains all of the ZIP + city/state combo from that file now.
- SAI_Peregrinus 1y agoZip+4 is needed to fill in city+state automatically. But I'd still rather type that first & have city + state auto-fill!