Falsehoods programmers believe about addresses
mjt.me.uk
mjt.me.uk
* The address format is uniform across the country (Sapporo has its own, and Kyoto uses an alternative system on top of the standard one)
* Addresses go from the most specific to least (e.g. flat number to postal code), japan is the exact opposite
* Addressing systems don't change (Japan's was reformed in 1998)
* Building numbers are street-based (Japan's are block-based)
It also expands on things like "addresses will have a street": standard japanese addressing is subdivision-based so addresses provide the prefecture, the ward (~county), the district and the city block.
Except for Sapporo and Kyoto (see 1): Kyoto allows an denoting blocks as the intersection of two streets and the position relative to the intersection (north, south, east or west). One reason is that some wards have multiple districts with the same name... Sapporo uses a system where blocks are addressed by their distance (in blocks) + direction from city center, so you might be told the address is "the 4th building, 3 blocks north and 5 blocks east".
Singapore is another good one: its postcode scheme changed twice in less than a century, and being a city-state, there is nothing useful to put in a "city" field (mail is often sent to "Singapore Singapore", or even "Singapore Singapore Singapore").
Good point, which should apply to most city-states (e.g. Monaco, or the Vatican)
Best to think of it as an onion. On the outer layers (beginning and end) automated and semi-automated sorting can be applied most easily (the ZIP code was designed for automated sorting and routing). Apartment and suite numbers in the middle are handled (usually) manually by carriers already at or near the service address.
I've seen natives handle that problem by filling in their district in the "city" field, so e.g. in my case "<street>, Minhang district, Shanghai China", analogous to e.g. "<street>, Nob Hill, San Francisco, USA".
This is both a comical inconvenience for travelers (try finding an address without speaking the language), and a huge problem for porting any sort of local-data application to Japan.
100-0001 (ZIP Code) 東京都 (Tokyo-to, Prefecture) 千代田区 (Chiyoda-ku, City) 千代田1−1 (Chiyoda 1-1, Area Block-Subblock)
Japan et. al. add another layer of complexity, other text encodings etc. etc., but even in the seemingly simple case of English being used, it's not quite as simple as many forms make it out to be.
A format of:
Statement of Falsehood
Explanation / Description
Counterexamples
Suggested mitigations
would be fine. It'd make it possible for us to submit ones that aren't apparent to the originator.In this case, most of these issues can be avoided by allowing a free text field instead of dedicated fields for street name, number, apartment, floor, state, county, district, and whatever.
The correct way to handle this is to be able to dynamically accept and store arbitrary granularity of data (and be able to translate that into a single text field at runtime if needed).
The problem is that free form text fields are the opposite of over-engineering, because you're exchanging complexity at input time for the impossible task of parsing what the user typed in later on. Garbage in, garbage out.
An optimal way to tackle complex addresses is allowing the user to fill a free-form address, but annotate with meaningful metadata so you have useful data. Something like this:
[Number ] [24] [Street ] [Westover Lane] [City ] [Palm Coast] [State ] [Florida] [Zipcode] [32164]
[+ Add another field]
One compromise would be to impose an address schema by default, but allow users whose addresses are incompatible with it to opt out of it and enter a free-form address.
Here's an example from Citibank India website:
Citibank,
No. 91, Prestige South End,
South End Road, Opposite Surana College,
Jayanagar, Bengaluru - 560 004State Bank of India, No.997, Opposite To Bus Stop, Service Road, 4th Cross, 9th Main, Rpc Layout, Vijayanagar, Bangalore - 560040
Most programmers here assume stuff US-like in addresses.
Well, and government forms even frequently require a specific style of address (Street - building number, city, state, zipcode)
But in Brasilia (Brazil capital) it already breaks.
A typical address there for example is: Building 3, Apartment 12, Block H2, Residental Section, North Wing, Brasilia
As you can see, Brasilia does not have street-based addresses, in fact most streets there are not named at all, the city was made on purpose to allow this new type of adressing that the city planners thought it was better.
Also, zipcode precision is almost random, I lived once in a building with 20 apartments that had its own zipcode, and I also lived in a city with 150.000 people that had only one zipcode, and I know a building that has has three zipcodes.
And there is zipcodes for streets, neighborhoods, and several other random things.
And the coolest feature of all: brazillian zipcodes can start with a zero, breaking every stupid database that store them as number instead of string.
Also, streets not only can have more than one name, it is possible to the post office have the WRONG name.
I lived once in a street named "Gracia Mauro Chieni", and for many years it was listed on post office as "Graça Maria Cheni"
After nagging them a lot, they fixed...
It was now: "Gracia Mauro Cherene"
And of course, sites that used the post office company API to find the zipcode worked great with the name of that street ;) (NOT)
Oh yeah, remember the street I mentioned, the one with two wrong names in the post office? Well, in the power service registry (That in Brazil is valid as address proof and some other address related things), the name of the street is "H", yes, just one letter... It was the original name of the street when it was first opened, and they never bothered to fix it in their database.
Considering the number of countries with alphanumeric zipcodes, or zipcodes with interspersed signs (e.g. japan is \d{3}-\d{4})... the mind boggles.
SQS 102, Bloco A, Apt 100 Brasília, DF 70000-000
That is SQS or SQN and the number indicating which wing and which section. And the Block and Building are also the same. Are there places in the city that actually require the long format you describe?
* Address encodes where the building is physically located
* It does not matter whether address is written as name, company or company, name.
* That there is some unique mapping between postal codes and geographical areas (or post offices). I've seen buildings that have different postal code depending on what shipping service you use and multiple discontinuous areas that have same postal code.
* Address has exactly one city/town (although in Czech case most such addresses does not have street)
* Address contain non-latin characters used only in one language.
* Non-latin characters in address can be mapped to ascii in non-ambiguous way.
* Address is always written in order from most specific to least specific.
* Buildings whose number differ only in letter postfix (33a vs. 33e) are near each other. Alternatively: such postfix does not matter.
* There is single building number for address. (Czech addresses have two building numbers, usually only one is written in address, but for some places you either have to write both or indicate which one you mean)
* Addresses can have accented or other foreign characters.
I ordered a package to "Fäkéstreet", but it arrived addressed to "Fäkéstreet", luckily the postman was smart enough to decipher it.
I have also run into the address length issue, even thou my address is only 54 characters long.
For instance, the "unicode snowman" is because MSIE 5-8 will refuse to send a form as UTF-8 (completely ignoring `accept-charset`) if it can encode everything to Latin-1. Conversedly, most browsers will default to UTF-8 (but I believe normalization may vary). If the system was built in the early 00s and only tested in MSIE, it might well expect all input data as latin-1 (because that seemed to work at the time) and crap out when UTF-8 comes in.
to convince IE that it's supposed to be sending UTF-8, not latin1 (And so the site can recognize if the input was likely mangled.
* Street numbers are integers.
A house near my university was numbered something like 3 1/2. It was between 3 and 5, and 4 was taken by a house on the other side of the street. I'm also sure I've seen houses with 1/4 and 3/4 in their numbers. Platform nine and three quarters doesn't need to be magical!
I once lived in a house that was numbered 50-2. A lot of U.S. websites wouldn't accept the hyphen. Fortunately, I could just truncate it to 50 because there were only a handful of houses with the same prefix and the postman knew where my family lived.
I also once lived at an address where the street number had the suffix "B".
I also lived on a street (~15 years ago -- without numbers. Small country town, the Postman knew who we were -- only 5 houses on the street)
> The user will know their postal code/zip code.
Which assumes that the user has a postal/zip code. For a counter example, all addresses in the ROI outside of Dublin do not have postcodes. (And most online sites won't validate Dublin postcodes either, being of the form D4 or Dublin 4 for example)
Which works fine on the envelope, postman hardly notices, but leads to another one for the believing programmers: a postcode field contains a postcode
As a software developer, I'd like to propose some changes in the world.
1) Addresses should be the very precise lat/long of the mailbox + the name of the recipient. Nothing else.
2) There should be one time zone for the whole world and no daylight savings. Time should be 24-hour-based. Perhaps you'll need to set your personal alarm for 19:00 in the "morning". Tough.
3) Nobody is allowed to change their names.
4) Whoever keeps sawing outside our building should stop.
That is all for now. I look forward to the complete capitulation of all world leaders to my frank good sense.
Thank you.
GB Technical Services
Unit W7a, Warwick House, 18 Forge Lane
Minworth Industrial Park, Minworth
Sutton Coldfield, B76 1AH, United Kingdom
I don't think British people would actually write it as eight lines. Does anyone have a better example of an address that does not reasonably/conventionally fit on five freeform lines?
(http://www.royalmail.com/personal/help-and-support/How-do-I-... specifically wants postcode on a line of its own.)
GB Technical Services
Unit W7a
Warwick House
18 Forge Lane
B76 1AH
The postcode effectively encodes the post town and county. It may not be easily 'human readable' but Royal Mail will deliver it no problems.
https://en.wikipedia.org/wiki/File:Letter_to_Russia_with_kro...
Over beers a few of my mates came up with a system like DNS to map a mailing domain for an individual/organization to a physical location. But after much discussion we decided it was just easier to let the geo-challenged to lease postal boxes with saner locations.
Isn't that what ZIP codes should have been?
In the UK my postcode is limited to not many addresses. (Mine is 10, but they can be more.) The Post Office database is widely used. It's not always particularly accurate. While there's no official database of addresses the Post Office database is pretty close.
They are not very precise, which is to be expected since there are only about 100000 possible postcodes in our scheme.
Moral: The best content doesn't always stay on the front page for any length of time, you should check out /newest once in a while too.
You're over-generalizing your personal experience: I've run into quite a few experienced programmers who just haven't spent enough time working on geo code to understand how treacherous it can be, particularly if their past work hasn't been sufficiently international. This is particularly bad with low-level / overly-academic developers who think the problem is that previous attempts failed because they didn't model addresses sufficiently rigorously.
I guess the district-based addressing system made a lot of sense back when people just built houses in random locations around the town center.
Anyhow true. I recall the "Apply for this position" form of a big player, open to remote working. A full US address was actually required to submit /facepalm
street_name 42/38/13
Yes, with slashes. It's the number of the block, then the number of the stairwell, and then the number of the flat. I cannot enter that bloody number anywhere online, every website shouts at me that it's incorrect. It's not, I think I know where I live!
BTW the zip code contains the letters and the dash too.
We (my company Nestoria - a real estate search engine in 8 markets) have to geocode tens of thousands of listings a day all with incomplete or haphazard address info. Here's a talk one of our guys gave a few months ago about how we do it. TL;DR - geocoding real world data is hard
http://www.lokku.com/nestoria-geo-system/
he's going to give a much more detailed talk at the next #geomob if anyone is in London and interested: http://geomobldn.org/post/47481139743/date-set-for-july-geom...
The common case that fails badly is where two people in the same apartment block share the same surname. There is no good workaround for this case, especially given the German resistance to putting first names in formal correspondence.
There were 12 units in the building and I don't believe they had numbers. The occupants attached their names to the mailboxes outside the building so the mail carrier knew which box to put things in.
5 Division
Australian Defence Force Academy
Department of Defence
Canberra ACT 2600
Or another one: Officer's Mess
RAAF Williamtown
Newcastle, NSW
Both military of course. Try sending mail to someone stationed on a boat, uh sorry, ship!I'm sure various universities, government departments, and companies have similar silly situations. For example I would be willing to bet that you get some very weird addresses in some mining operations.
Ralph Rackstraw
19 Starboard,
HMCS Pinafore,
CFB Halifax, NS (, CANADA - optional)
X1X 1X1
The system in Oz at least used to be similar. Which is great if you're actually posted to a vessel. That isn't always the case in Canada; we air types, the folks what flies and fixes the helicopters, are nominally "Air Force" and are seconded to ships for voyages only, remaining on squadron strength back at our home airfield, so unless one is vigilant about changing addresses every few weeks, important mail may be headed to your post box at the barracks while you're at see and to the ship while you're at home.http://www.unece.org/trade/untdid/d04b/trsd/trsdnad.htm
As you can see, only the 3035 "PARTY FUNCTION CODE QUALIFIER", telling if this address is a buyer, a supplier, a shipper, or something else, is mandatory and everything else is conditional.
You have 5 optional lines of "Name and address description", 5 optional lines of "Party name", 4 optional lines of "Street and number or post office box identifier", an optional "City Name", several optional "Country Sub-Entity Details", and optional "Postal Identification Code" and an optional "Country name code"
I think that pretty flexible, allowing short addresses like "27321 Finkenburg, Germany" and long ones also. The main restriction is line length, so the address has to fit onto an envelope.
Reparto Serrano, de la Policía de Plaza del Sol 4 cuadras al Lago, Casa esquinera Managua, Nicaragua
Translation: Serrano Division. From the Policía de Plaza del Sol go four blocks towards the lake (which is North in Managua). Corner House. Managua, Nicaragua.
Absolutely crazy. No street names at all. Addresses are really directions from well-known places (except when it doesn't exist anymore - "de donde fue" : "from where there was.."). They use the old spanish unit 'vara' - 84 cm instead of the meter to specify houses within blocks. Up and down aren't north and south; they're where the sun goes up and down (east and west).
More information here: http://vianica.com/nicaragua/practical-info/14-addresses.htm...
I'm somewhat biased against BW as my (disabled) father had his boat repossessed under a "section 8" with no warning and was made homeless because he did not supply them with a "fixed address". When confronted a few months before the eviction BW even refused to take an address my father's advisor offered during the meeting because they knew it wasn't his. Even after confirming that they do no background checks on addresses and knew full well that most boaters were using addresses that were not their own.
There are real human costs to these sorts of things and my dad was one of those people caught up in a self reinforcing loop that saw no solution. Fortunately it is an edge case, and most likely the result of corruption - the £30K+ boat was eventually sold on by BW for £5K and my dad never saw a penny. He can't even contest the decision in court because it would cost a small fortune.
In Minneapolis, all the streets are numbered by their distance from the center of town, and the north-south thoroughfares are called Avenue, while the east-west roads are called Street. So if someone tells you they're waiting for you at the corner of 2nd and 4th, you have 8 potential intersections to check.
Everywhere else in the cities (OK, that may be hyperbole) building addresses have something to do with intersecting streets. For example, 47 7th Avenue is going to be between 4th and 5th Streets, closer to 5th (and on the west side of the road). God help you if you try to apply that logic in St. Paul. Their numbers bear no relationship at all to their cross streets.
Finally, while my Maplecliff example above evinces a certain laziness or lack of creativity on the part of the subdivider, I think the height of laziness has to go to the subdividers who don't even bother to come up with a whimsical base name for their streets, and just name them after nearby, already-existing roads. Especially when said existing roads are merely numbered roads. You'll get road names like 172nd Street Circle or 163rd Avenue Way. And yes, I did once see a 185 Street Lane Court.
A friend from Arizona reports that in his city, NS roads are Avenues, and EW roads are Streets, but there was one road that cut diagonally through the city--so they called it a Stravenue. Abbreviated Stra, if I remember correctly.
http://www.elections.il.gov/downloads/votinginformation/pdf/...
IF YOU HAVE NO STREET ADDRESS,
below describe your home: list the name of subdivision; cross
streets; roads; landmarks; mileage and/or neighbors' names.Also, house numbers are sometimes not sequential. Some people have "favorite" number and when they see it's not taken, they will use it ("Nobody in the neighborhood has 123, so it's mine.")
Actually, Salt Lake City in Utah is sort of vaguely like that, though with street numbers (in the usual units of 100 per block) rather than latitude and longitude per se.
The addresses are things like "250W 500S, Salt Lake City" -- which is going to be on the fifth street north of the Temple (and marked as 500S on the street signs), two and a half blocks west of the north-south street that's centered on the Temple (which is Main street, not W. Temple Street. W. Temple Street is what would be 100W if it weren't named).
I'm not sure what the history is on canonical orderings of the two parts of the address. Currently it seems to be usually the one that's the "street number" followed by the one that's the "street name", but I'm not sure if that's a result of auto-regularization by systems that assume such a thing, or if it's historical.
I was opening an account at the Lloyd's TSB Branch in Hanover Square (http://www.allinlondon.co.uk/directory/1063/11849.php). Turns out their address form requires the first half of a postcode to end in a number, even though the address of the branch itself ends in a letter.
I believe my grandparents only got a street assignment in the last 2 or 3 years -- and even then, the actual street is about 2/3 of a mile from their house.
One where they live, and the other where they receive mail. Up here in Rural California, that is the case, postal delivery is not a given to most of the residences. Sometimes the only delivery option is getting a post office box.
I grew up at the address of "Route 1, Box 78, City, State ZIP". That was the rural mail delivery route, but it was the only actual address there was, unless you wanted "last house on county road 601 before you go over the top of the mountain" sorts of things. (The mailbox in question was on a post at the end of our driveway, and said "78" on it.) UPS and FedEx would deliver there, though sometimes we had to point out to a new UPS driver that no, we weren't box 79; they were two miles away on the next bit of the mail route.
This also points out the changeability of addresses. Before I was old enough to remember, it was Route 1 Box 150A. And then ten or fifteen years ago, they went through and named all the streets and numbered all the houses, so it became "420 Streetname, City, State ZIP". The postman still knew that when my grandfather sent mail to Box 150A it should come to us, though.
My current house is a duplex. The normal scheme would be something like "100 Streetname, unit A" or something, but somehow we ended up with "100A Streetname" instead. For added confusion, the actual doors aren't labeled, just the mailboxes.
- Not if it is a new build, had a temporary postcode during construction and has since been assigned a new postcode.
(In the UK) an address will contain a county.
- Not if it is in London (city and administrative county).
The best you can do is hit the 80/20 rule: provide a solution for most addresses/phone numbers out there and minimize the edge cases.
In some places in Africa this is definitely true, an example of an address in Mauritius would be "Second house on the right, past the hindu temple, the house with the red wall".
I cannot help but feel, though, that this is inviting ruin and disaster. I'm currently dealing with some of this myself--what's the best solution other than just forcing people to use a five-line US-stle address and hope for the best?
http://msmvps.com/blogs/jon_skeet/archive/2010/12/01/the-joy...
His talk in London Dev Days 2009, also goes into problems you can have with dates and timezones (including Argentina's 2009 last minute time zone change back into not using daylight saving time).
And that means that unix time at a resolution higher than a second will jump backwards at those 35 different leap seconds.
Monotonic functions can yield repeated values, they don't have to be strictly increasing or decreasing. A constant function is monotone.
> And that means that unix time at a resolution higher than a second will jump backwards at those 35 different leap seconds.
Yes sub-second timestamps won't be monotonic, but UNIX time (or POSIX time) is only defined with a resolution of a second, so it is monotonic.
In practice though, "unix time" is merely a convention which is based off of the POSIX standard.