Live data from Hacker News

Put the zip code first

zipcodefirst.com

171–180 of 330 posts

Re: Put the zip code first

#171
Awesome idea, IF you are US only and don't cover edge cases and (want to depend on an external API or want to have some sort of eventually outdated map of city postcode).

It is possible to do this properly, e. G., DHL and UPS do a somewhat okay job of it but isn't easy.

Re: Put the zip code first

#172

Earlier quoted context omitted.

USPS doesn't care; each ZIP code has a single preferred city name and a list of acceptable alternate city names to account for cases in which a ZIP code spans multiple cities. However, USPS's address validation will prefer to use the preferred city name for the ZIP regardless of whether the recipient actually lives within the boundaries of that city. That's because USPS has opted to organize addressing entirely aroun…

But addresses aren’t just for sending mail. Location also determines which municipal and state laws apply, so there are contexts where the distinction matters.

These things shouldn’t be based on the zip code.

Re: Put the zip code first

#173
post #149

Earlier quoted context omitted.

> A city can also exist in multiple zip codes. And there can be multiple cities with the same name in the same state. These are reasons you cannot deduce the Zip from the city, not the opposite. A ZIP+4 actually encodes all other information for a US address.

ZIP+4? I think that's literally enough digits to give every house in the US (about 150,000,000 apparently) its own identifier.

There are far more addresses than there are houses

Re: Put the zip code first

#174
post #69

Earlier quoted context omitted.

This 1000 times. I’ve tried implementing what OP has mentioned, and quickly learned it isn’t possible. A city can also exist in multiple zip codes. And there can be multiple cities with the same name in the same state. So, to be safe, you have to enter city, state, and zip.

I don’t understand either of these arguments. They both appear to reinforce the point made in the article. At worst a zip code contains multiple cities? Voila the city box becomes a dropdown. It’s 2025. JavaScript.

Indeed. I don't always even do the drop down just make it autofill a still editable text box

Re: Put the zip code first

#175
post #69

Earlier quoted context omitted.

This 1000 times. I’ve tried implementing what OP has mentioned, and quickly learned it isn’t possible. A city can also exist in multiple zip codes. And there can be multiple cities with the same name in the same state. So, to be safe, you have to enter city, state, and zip.

There are enough ZIP+4 codes for about a billion addresses. Many addresses I've lived at in the US have had a unique ZIP+4 code.

The digits aren’t random though, some of them have meaning.

Re: Put the zip code first

#176

> From those 5 characters you can determine the city, the state, and the country False. Many zip codes include more than one city, and some even cross multiple states. And you can't always tell the difference between codes from different countries. Now you're not just instantly filling the rest of the form, you're implementing fancy multi-country filtering logic, editable drop downs, etc. Given the obvious incompeten…

GPS coordinates is the answer.

Re: Put the zip code first

#177

Earlier quoted context omitted.

USPS doesn't care; each ZIP code has a single preferred city name and a list of acceptable alternate city names to account for cases in which a ZIP code spans multiple cities. However, USPS's address validation will prefer to use the preferred city name for the ZIP regardless of whether the recipient actually lives within the boundaries of that city. That's because USPS has opted to organize addressing entirely aroun…

But addresses aren’t just for sending mail. Location also determines which municipal and state laws apply, so there are contexts where the distinction matters.

It’s more that the municipal “geofence” encompasses a certain area, and all addresses that fall within that space belong to that municipality. I.e. the address doesn’t determine the location, it just happens to be located somewhere.

Re: Put the zip code first

#179

> From those 5 characters you can determine the city, the state, and the country False. Many zip codes include more than one city, and some even cross multiple states. And you can't always tell the difference between codes from different countries. Now you're not just instantly filling the rest of the form, you're implementing fancy multi-country filtering logic, editable drop downs, etc. Given the obvious incompeten…

USPS doesn't care; each ZIP code has a single preferred city name and a list of acceptable alternate city names to account for cases in which a ZIP code spans multiple cities. However, USPS's address validation will prefer to use the preferred city name for the ZIP regardless of whether the recipient actually lives within the boundaries of that city. That's because USPS has opted to organize addressing entirely aroun…

I agree using the preferred city name works just fine for USPS, though maybe not for UPS/Fedex.

What I want to know is: Why isn't this preferred city+state mapping dataset for zip codes publicly available from USPS? It would be like 40kb of data for the entire thing. Why is this not public domain from the US Government?

Edit: or is this what I'm looking for (the "Physical City", "Physical State" columns? https://postalpro.usps.com/ZIP_Locale_Detail

It's missing 00501 at least (which zippopotam has), and military zip codes (which zippopotam doesn't have). Military zip codes are included in this file: https://postalpro.usps.com/areadist_ZIP5

Also fun fact 88888 is for "Operation Santa" uspsoperationsanta.com, which zippopotam is missing, but appears in the areadist_ZIP5 file.

Re: Put the zip code first

#180
Zip codes do not have a one to one relationship to cities in the US. It's a common misconception. It's true about 90% of the time, but there are a lot of outliers. I used to work with GIS data and there are a ton of exceptions.
Post reply on HN