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 around the ZIP codes, and other political boundaries are irrelevant except in cases of problems interpreting the address.
This does mean that you might autofill a city name that is "wrong" in the view of the person completing the address form, but much of the bulk mail they receive probably uses that city name anyway.
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.
The preferred city is almost always the location of the post office serving the ZIP, which makes this situation fairly intuitive. You can find some interesting edge cases where a post office in located in a suburb city, resulting in a ZIP that includes part of a major city having the suburb as its preferred city name.
You can look up the city name and alternates for a ZIP here: https://tools.usps.com/zip-code-lookup.htm?citybyzipcode
and the Domestic Mailing Manual covers this, although it's scattered across several sections and mostly part of how the City State database (the database used for validating city and state names in addresses) works.
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?
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.
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.
> 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-aware what city they live in, versus what's on their postal address? I sure as heck have always assumed whatever my mailing address says is the city I live in; I can't imagine a ton of people questioning it.
Doesn't this mean a ton of citizens would be registering for the wrong state's elections? Do the election officials always catch these? What about businesses - don't they constantly pay taxes incorrectly if the address is written incorrectly? What about laws (say privacy, wiretapping/call recording, etc.) where people make assumptions based on the city and state - what if they're wrong because the written city isn't the actual city? Who's criminally liable then?? Does every business have to perform a jurisdiction lookup to make sure an address isn't misleading?
My dad had an address in Morgantown, Indiana, and the fact that he lived several miles south, over the county line and past antother small town, always made it pretty clear to me that he didn't live in Morgantown.
Likewise, if you live in another state, there's little confusion because state lines appear on maps and are well marked on all major roads.
Businesses and individuals are responsible for knowing which state they reside in and paying the appropriate taxes, regardless of where their mail is sorted.
As for elections, electoral districts don't generally align with city limits in the first place, so this has to be sorted out by the election registration system based on the full address in most cases anyway.
As for what city name appears in legal documents, the answer is that "preferred" doesn't mean "mandatory". A warrant to search the Indianapolis Motor Speedway, 4790 W 16th St, Speedway IN, 46222, would be perfectly valid, despite the fact that the USPS prefers mail to be addressed to "Indianapolis" rather than "Speedway". For there to be any possibility of confusion, you'd need to have two distinct locations, whose identical addresses share a ZIP code, and differ only by city name, which for obvious reasons the postal service will not allow.
Thanks for explaining! That's a great perspective/experience that helps me understand it better.
Re: legal documents: there are less severe cases than warrants that I would expect to trip a lot of people up, which is what I'm wondering more about. Example:
ZIP code 97635 is apparently in both Oregon and California. The post office for both sides of the border appears to be in New Pine Creek, OR 97635. So if someone provides you with that address, you would quite naturally assume they're in Oregon. And you might collect taxes, record calls, or sell their personal data based on that. But whoops! Turns out they're actually in California, so you just broke a bunch of privacy laws on top of missing tax payments to California, in some cases potentially risking criminal penalties.
Wouldn't this trip a lot of people up, especially for smaller entities? I can understand multi-billion-dollar businesses having this all handled correctly, but for individuals or smaller businesses, wouldn't it completely throw them off and potentially subject them to criminal penalties? (How) would people deal with this?
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.
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.
I would just like to point out that the city field doesn’t necessarily prove anything because many unincorporated areas have a listed a city but may not be subject to the laws or taxes of a municipality. So having the correct city isn’t as useful as one thinks it is.
I used to live in just such a place. Went to the city center to apply for a library card, thinking "of course I can get a card here, I live in Foo City and this is the Foo City Public Library." I was asked for my street address, and she pulled out a binder of street names to check (yes it was analog, in the year 2016 A.D.). I was not within the city limits and was denied a card.
I live in a zip code that spans two cities and I live in the unincorporated area between them, but with one of the cities in my preferred address. So at least two of the exceptions listed in this thread apply.
This is accurate. For a scenario with a possibility of litigation you must ultimately geocode the address with google maps API or census geocoder, point in polygon against district boundaries (geopandas or shapely), then pass the result through a rules table keyed on jurisdiction + case type.
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.
This does mean that you might autofill a city name that is "wrong" in the view of the person completing the address form, but much of the bulk mail they receive probably uses that city name anyway.
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.
The preferred city is almost always the location of the post office serving the ZIP, which makes this situation fairly intuitive. You can find some interesting edge cases where a post office in located in a suburb city, resulting in a ZIP that includes part of a major city having the suburb as its preferred city name.
You can look up the city name and alternates for a ZIP here: https://tools.usps.com/zip-code-lookup.htm?citybyzipcode and the Domestic Mailing Manual covers this, although it's scattered across several sections and mostly part of how the City State database (the database used for validating city and state names in addresses) works.