Git Product home page Git Product logo

wtf-zipcodes's Introduction

WTF, Zipcodes?

Mr. ZIP

ZIP codes are the United States Postal Service's method for identifying a mail delivery route. Practically, they are often used as a method to denote a general locality on web applications that rely on user location (i.e. nearby restaurants).

ZIP codes are often a source of confusion because they're fundamentally different from other types of location data.

ZIP Codes are sets of points, not areas

Map of the United States with Arkansas highlighted

Area of the state of Arkansas (Licensed CC BY-SA 3.0)

Regions like states, countries, and counties are defined by their borders and when represented as geographic data they are represented as polygons. This means that these regions have area, centerpoints, and a simple way to determine whether a given point is inside or outside of the region.

USPS ZIP Codes are not areal features but a collection of mail delivery routes. -USPS

ZIP Codes are not regions or polygons: they are collections of points. The original purpose of the ZIP Code is to organize mail delivery points into convenient groups for mail carriers, so points are chosen based off of roads and accessibility, not regions.

The final 2 digits of a zip code have very little geographical meaning, but the first 3 do. That said, these aren't guarantees around this meaning: while the first digit tends to identify that a ZIP Code is within a given group of states, it doesn't guarantee that the code stays within a single state.

  • 0: state group (this includes many New England states)
  • 79: region (this area of New Jersey)
  • 30: delivery group

ZCTAs are approximations of ZIP Codes as areas

Enough people expect ZIP codes to be areas and want to do calculations based on them as areas that USPS has provided an estimation: ZCTAs. These are generated by taking each collection of addresses in a ZIP code and drawing a boundary around them.

There are gotchas in this process, since there are many places in the United States with no addresses, so they don't clearly belong to any ZIP. There are also ZIP codes that are completely unique - buildings and military bases can have their own ZIP even if they're totally surrounded by buildings with a different ZIP.

Geographical Q&A

What ZIP code is this longitude, latitude point within?

Not clearly defined: ZIP Codes contain address points, and are not areas. You can answer this question with either

  • Determining which ZCTA the geographical point fits inside
  • Snapping the point to an address and the address will have a ZIP code

Given this ZIP Code, what state, congressional district, etc is this person in?

Not clearly defined: ZIP Codes have rough, estimated centerpoints, but are not really a good way to indicate areas. 1

What ZIP code is this address in?

This is clearly defined: every address has a ZIP code, and you can find this with most geocoders.

Notes

  • ZIP & ZCTA are both acronyms, and thus should be upper-case: Zone Improvement Plan, and ZIP Code Tabulation Areas
  • ZIP Code & ZCTA are both Trademarked by USPS

wtf-zipcodes's People

Contributors

iandees avatar lyzidiamond avatar tmcw avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.