Hacker News new | past | comments | ask | show | jobs | submit
I worked somewhere that purchased ZIP code polygons from somewhere at one point, pretty sure it was way way cheaper than this. Idk if there was a difference in quality.
ZIP codes aren’t even guaranteed to be polygons. Most data sets use the census bureau’s ZIP code tabulation area.

https://en.wikipedia.org/wiki/ZIP_Code_Tabulation_Area

There were multiple polygons per ZIP code. Or do you mean it can have round boundaries?
No, it's a more fundamental problem: Zip codes are not "areas" and have no boundary.

Instead, what they are, are collections of mail delivery points. The "full" 5+4 zip code represents one mail delivery route that a postman follows to deliver mail. And the "fuller" 5+4+2 zip code has the last two digits of the street number.

So couple issues with trying to make polygons from zip codes:

1. There is no guarantee that a given zip code has a finite area. There are several zip codes that exist at a single street address. So... is that a point? Is it the footprint of the building where the mail is delivered? Maybe a hexagon with some minimal side length? Examples: Several IRS return addresses, and some large hospitals.

2. There is no guarantee that a given zip code has a contiguous polygon representation. It depends on the algorithm you use to generate polygons from address points.

3. There is no guarantee that a given zip code has a fixed geospatial representation. Example: the armed forces zip codes for delivering mail to overseas personnel on deployment. The AFPO zips represent "wherever the troops happen to be today". How do you represent that as a polygon?

This is why the USPO has long resisted publishing polygons. It doesn't make sense at the conceptual level, so there are a bunch of weird edge cases you wouldn't expect if you naively treat them as polygons.

ALSO: The census does publish zip polygons. Some of those have zero people living in them (like the hospitals and IRS locations), so you can get weird div-by-0 effects if you aren't careful.

I suppose it's a polygon, but my PO Box has its own ZIP+4.

APO/FPO is a good counterexample, though even these presumably have domestic delivery points where the postal service hands off mail to the military (not that their locations should matter to postal customers).

Same goes for DPO addresses, I assume USPS doesn't actually deliver to embassies overseas (or at least does so under contract with the State Department if it does, and again consolidates deliveries at one or more domestic locations).

Oh, I meant the PostGIS "polygons" which can have holes in them. So #1 I believe they just had a small polygon, #2 was no problem, #3 wasn't supported but whatever. The polygons did overlap too.
Surely there has to be something of a one-to-many relationship with land parcels? Those have a finite area for sure.
loading story #50434980
Like most large data sets, ZIP codes are complicated. They are defined by delivery routes, so sometimes they overlap when that makes sense for delivery purposes. Some post offices with a lot of P.O. boxes can have their own ZIP code and that's typically represented as a point rather than a polygon. Large naval vessels have their own ZIP+4, and the base 5-digit ZIP code is a single point that is the land-based processing facility that the vessel is associated with. The same for some other types of military facilities and government buildings (e.g., the Pentagon and White House). I'm sure there are more special cases. It would be interesting to know how accurately the official data being offered here handles all this.

I came across all this when building maps for sales territories defined by ZIP codes. I needed to have a simple, clean partitioning of the US for this use case, and ZIP codes are not that. So I took all ZIP codes as points and generated a Voronoi diagram to yield clean, non-overlapping polygons that covered every point in the country. That was plenty good for the purposes of doing visualizations of the US split into tens of territories.

It took a bit of scrolling to finally find someone who understands that in most countries postalcodes can be rendered as areas — if you have the points of each address, using them to generate a Voronoi diagram.