Live data from Hacker News

Put the zip code first

zipcodefirst.com

301–310 of 330 posts

Re: Put the zip code first

#301

> 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…

To this, I once moved to a city in a neighboring country and ended up having the exact same zip code as where I moved from.

Re: Put the zip code first

#302

Earlier quoted context omitted.

Meanwhile, here in Bristol, a whole bunch of sites insist on using a drop down for the county and list "Avon" which doesn't even exist. It should be Bristol or possibly City of Bristol.

I think the county list is set in stone because Royal Mail refuses to update them (for some idiotic reason they still control the postcode database, which I guess lots of websites use and therefore use the old county names / boundaries). For example, it's still Humberside, even though that hasn't existed for decades.

Yep, I recall that Royal Mail is one of the websites that has the "Avon" issue. I don't know why they don't just update it to make it accurate as they update their PAF files for postcode lookups every three months with new postcodes. "Avon" is strange as it's still used in some contexts, such as the police force is known as Avon & Somerset

Re: Put the zip code first

#303

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…

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://post…

Unfortunately these USPS datasets are not public because USPS sells them. Or in some cases, the pattern tends to be that USPS has a contract with a provider (part of what I call the Postal Industrial Complex) that maintains the database and then sells it to both USPS and everyone else. Since these databases are used primarily by bulk mail services, they're fairly expensive and represent an important revenue source to USPS. Remember that USPS is semi-privatized, so they're looking for fees they can charge like everyone else... especially fees that can be changed more easily than postage rates.

That said, the ZIP DB is indeed not very large, so you can find copies of it. You won't generally find complete copies of the City State file but I wouldn't be surprised if there is one out there.

Re: Put the zip code first

#304

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…

> Technically speaking ZIP codes are not "supposed" to span states but, in exceptional cases, some do. In this case USPS handles it the same way: the state of the preferred city is the preferred state for the ZIP code. I've heard this before but it raises a million questions for me and I don't understand how this doesn't cause massive systematic problems and headaches in practice. Are residents even usually well-awar…

First, you're responsible for knowing where you live. Historically, people who lived in more challenging areas geographically often did not have regular postal addresses at all. You would just have a box number in the nearest town or a rural route stop number, and these obviously didn't reflect the legalities of where you lived. In our modern world, USPS has adopted a policy of 100% physical addressing, meaning that all properties now have a "real" address even if the number part is scaled from mileposts (as is the case in rural areas). Still, I think people who live in areas where any of this is less than obvious understand the nuance that how USPS handles addresses is not necessarily the same as how the voter registration clerk handles them.

Still, it is rarely a problem in practice, because anyone relying on addresses to establish these legal details will have to look at where the address is actually located---not just the city written in it. Keep in mind that quite a few people live in ZIPs where they could write multiple city names in their address.

When it comes to the unusual case of spanning states, it might help to note that the City State Database the postal service uses to validate addresses does not actually differentiate between city and state. "NEW YORK NY" is a single string. The state is really just part of the city name. The fact that USPS implemented it this way indicates the extent to which it does not matter in operational reality.

A sibling comment points this out, but it might also help to explain that in the US, it is very common for people to have mailing addresses in cities they do not actually live in. That's because of suburbs. City lines are often surprisingly arbitrary and reflect complex political histories. Many people consider themselves to live in [major city] but, in legal actuality, live in [unincorporated county that contains major city]. Many of the upsides of living in the city, sans some of the property taxes and voting in city elections! Yet another reason that people understand that mailing addresses are not definitive reflections of political boundaries.

If you ever work as an election clerk you will find this a LOT---people indignant that they cannot vote for the mayor, to whom you will have to explain, somehow for the first time, that they do not actually live in city limits. This tends to be more obvious if you get a property tax bill but a lot of people are renters and never really think about that aspect.

Re: Put the zip code first

#305
As pointed out by many comments, the post seems US-centric and using zip code doesn't work for all countries.

But just for reference, in Singapore, we use 6-digit zip codes, each of which can uniquely locate a single building, so yes, a lot of local websites essentially just expect a zip code plus unit number, without the hassle of typing out the address at all.

Maybe what I wanted to say is, the idea is cool and _can_ work to enhance user experience with proper localization.

Re: Put the zip code first

#306

Earlier quoted context omitted.

Yeah. But also, are you ready to maintain a postcode to city mapping for every country you have a significant userbase in?

I'm definitely not, but the lazy method is just to cache the data your customers provide, or curate some data for the countries you are most interested in. That gets around countries that consider their postal code database a licensed dataset.

That’s a clever way of doing it, yeah.

From UI side, I’d probably not autofill, but add autocomplete (e.g. using ¹). This way you can still have browser autofill the user’s address if saved (do also set the autocomplete² props correctly!), and suggest one or multiple variants you have in your database, and let the user fill it out manually still, without having to find and click “My address isn’t here”.

¹: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

(quick note re: compat; Firefox does support it for the text fields, check the table at the bottom)

²autocomplete: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

Re: Put the zip code first

#307
post #115

Falsehoods US programmers believe about addresses: there are no other countries than the US of A, and if there are, they don’t really matter. This person bought a whole domain for something that doesn’t work for 90% of the world, claiming it does, never even testing their assumption. Great job!

I don't disagree with you generally but does he really claim it does? The entire page only mentions US, near as I can tell.

Why would a US only address need a field for country?

Re: Put the zip code first

#308

US-centric. I typed a Mexico postal code (it’s five digits) and got routed to somewhere in Maine. So - yeah the whole “I can tell you’re in the US just by the zip code” premise is entirely flawed.

The best times are when US ecommerce sites try to confidently lint foreign addresses, even when they allow shipping there. I've had them tell me I need 5 digits for my postal code in Norway, which uses 4 digits. I selected Norway in the shipping web form. Or when they tell me special characters aren't allowed, yet the "special characters" are just letters in the Norwegian alphabet. My address contains ø. These aren't…

It’s irritating when they make country, region, and city all mandatory. Why yes, I live in the city of Singapore, in the region of Singapore, in the country of Singapore.

Re: Put the zip code first

#309
post #7

Earlier quoted context omitted.

Obviously put country first, then whatever the equivalent of a ZIP code is second. In the UK, a post code gets you down to around 15-16 delivery addresses on average. No-one there really _ever_ needs to type an address.

Most British websites work like this website suggests, in that they ask for the postcode first, then give you a dropdown of all the addresses at that postcode. It works great, except my address is for some reason not in whatever databases these websites use. The building number is on the list, but not the individual flats. So I have to put in the postcode, choose something like "My address is not listed", then fill i…

I had a similar problem. The way it was explained to me was that in practice, there are two databases used in the UK for this commercially and they don’t always agree. I used to live in a bungalow next to a large house that had been converted into flats. In one database it was listed with the bungalow name then the street name, and in the other database it was listed as “Flat 8” using the other building’s street address. About half of British delivery forms used one place, about half used the other.

Re: Put the zip code first

#310
post #97

In the UK, it's pretty common for the post code to be the first field in address forms, and for the form to then offer auto-completion for the whole address based on the post code. Postcodes are specific enough that the autocomplete will just give you a handful of addresses (e.g. my postcode will give you just the flats for the building I live in).

Irish post codes will get you the exact unit within the flats.
Post reply on HN