On Programming, Addresses, and Falsehoods

Sheel BediSheel Bedi
3 min read

I recently came across this list of misconceptions programmers have about addresses. This subject is near and dear to me - my first job in tech involved incorporating Google Maps APIs into web applications, and often times what looked like technical issues turned out be the limitations of geographic information.

There appear several lists of this kind, covering a variety of topics, and I’d like to identify a couple of additional misconceptions, specifically concerning the use zipcodes/postcodes:

  1. They do not cross state or provincial borders; ie, for any zipcode or postcode, a given address will necessarily be within the same state state or province. This is often true, but not necessarily so. In the United States, for examples, zipcodes can cross state boundaries. As a result, if you have an incomplete address that includes a postal code, you may be tempted to draw a conclusion about the state or province that address lies within. An interesting handling of this problem can be seen on the website of the U.S. House of Representatives, which allows you to find your representative based upon your zip. For certain zip codes, however, it will return multiple possibilities, sometimes in different states, because the data is simply not reliable enough.

  2. They represent defined, contiguous areas on maps; ie, they can be treated like counties, or states or provinces. Although this is a misconception, it makes a certain level of intuitive sense — we are used to thinking in terms of areas on a map, and postal codes are often used to geolocate — think of the last time you entered a zipcode to find the closest Target or Walmart! However, zipcodes are not actually areas on a map — rather, they are based on mail delivery routes, and there are noncontiguous zipcodes.

If you’re interested further in this topic, I’d recommend learning about geographic centroids. Centroids a specific point or set of coordinates associated with a postal codes. The location of these coordinates can be based on a variety of factors; a popular one is the center of population distribution. Therefore, when trying to locate things near a zipcode (like the closest Burger King) these coordinates are used.

I’ll confess that my experience is mainly in the American context, working with zipcodes — foreign postcodes might behave differently, though I think the caveats I’ve identified here still apply. Moreover, while these beliefs are mistaken, they aren’t unreasonable. These are often true — often enough that you can get away with relying on them most of the time; locating a retail establishment based on a zip code is prominent example.

However, that’s also what makes these assumptions dangerous. They seem true enough that you might not think the question it, and when you hit an edge case, the results can be truly confusing.

0
Subscribe to my newsletter

Read articles from Sheel Bedi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sheel Bedi
Sheel Bedi