Live data from Hacker News

Stop using zip codes for geospatial analysis (2019)

carto.com

101–110 of 134 posts

Re: Stop using zip codes for geospatial analysis (2019)

#101
post #14

ZIP codes are an emergent property of the mail delivery system. While the author might consider this a bad thing, this makes them "good enough" on multiple axes in practice. They tend to be: - Well-known (everybody knows their zip code) - Easily extracted (they're part of every address, no geocoding required) - Uniform-enough (not perfect, but in most cases close) - Granular-enough - Contiguous-enough by travel time…

This is a tangent, but addresses are also way more complicated than most people realize - especially if you’re relying on a user to input a correct address or if you need to support multiple countries, somewhere with unique addresses like Queens[0], or you need to differentiate between units of a specific street address that uses something other than unit numbers for a unit designation. At that point you need somethi…

Addresses are a huge ordeal in banking. Easily one of the most tortured domain types when it comes to edge cases and integration pain.

Every customer I've worked with insisted on having all addresses ran through the USPS verification API so they could get their bulk mailing discounts.

Even if you get the delivery/cost side under control, you still have to make sure you are talking about the right address from a logical perspective. Mailing, physical, seasonal, etc. address types add a whole extra dimension of fun.

Re: Stop using zip codes for geospatial analysis (2019)

#102
Well funny story, some twenty something years ago I actually worked on an election cycle volunteer infra thing in France, and living in Paris which is department 75 and therefore 750xx the prefecture being 75000 I assumed it was neatly hierarchical 75004 won't be far away from 75003 (true)... The French thing being orderly and rational.

I didn't need much precision so truncating seemed an easy way to group stuff.

Oh the surprise. I never again made such assumptions, let's just say I should have gotten a clue from Corsica being 2A and 2B.

Re: Stop using zip codes for geospatial analysis (2019)

#103

Earlier quoted context omitted.

Zip codes (in the US) are machine readable numbers a mail sorter can use to send a parcel to the right delivery truck for final delivery. In the US, they represent the hierarchy of postal centers with the most significant digit representing the primary hub for a region and the smallest number the actual post office that will be in charge of delivering the letter (or truck if you do the extended post code). They don't…

I agree that they weren't explicitly meant to represent geography, but implicitly they do, right? Are there cases where this is violated? In other words, is it safe to assume that for entity in a zip code is less than x distance away from the closest entity in the same zip code?

it is safe to assume nothing.

Please see: https://opencagedata.com/guides/how-to-think-about-postcodes...

I write this as someone who grew up in the ZIP code 09180

Re: Stop using zip codes for geospatial analysis (2019)

#104

Earlier quoted context omitted.

Zip codes (in the US) are machine readable numbers a mail sorter can use to send a parcel to the right delivery truck for final delivery. In the US, they represent the hierarchy of postal centers with the most significant digit representing the primary hub for a region and the smallest number the actual post office that will be in charge of delivering the letter (or truck if you do the extended post code). They don't…

I agree that they weren't explicitly meant to represent geography, but implicitly they do, right? Are there cases where this is violated? In other words, is it safe to assume that for entity in a zip code is less than x distance away from the closest entity in the same zip code?

It might be true, but does it help if the x varies from "on a nearby mountain" to "within a street block", and you sometimes have every habitants closer to another zip code than theirs ?

Re: Stop using zip codes for geospatial analysis (2019)

#105

Earlier quoted context omitted.

This is a tangent, but addresses are also way more complicated than most people realize - especially if you’re relying on a user to input a correct address or if you need to support multiple countries, somewhere with unique addresses like Queens[0], or you need to differentiate between units of a specific street address that uses something other than unit numbers for a unit designation. At that point you need somethi…

Yes, unfortunately, their assertion that everyone knows their zip code is wrong. People often write a neighboring code, and the post office just delivers it. Similar issues for city name, of course.

They know their ZIP code far, far better than any other plausible geographic cell.

Re: Stop using zip codes for geospatial analysis (2019)

#106
post #35

Earlier quoted context omitted.

Zip codes (in the US) are machine readable numbers a mail sorter can use to send a parcel to the right delivery truck for final delivery. In the US, they represent the hierarchy of postal centers with the most significant digit representing the primary hub for a region and the smallest number the actual post office that will be in charge of delivering the letter (or truck if you do the extended post code). They don't…

Right but this ends up being a good approximation for geography because the reality of logistics is that you end up doing a cute n-ary search of the geography. When you know the regional hub you can say for certain a huge chunk of the US the zip code doesn't represent. And then you keep n-secting. Sometimes the land-mass you get at the end is specific enough for your uses. You're not going to wind up with a situation…

> You're not going to wind up with a situation where zip codes with the same regional marker end up on different coasts.

Couldn't this happen for military or proxy codes (PO boxes or other) ?

Re: Stop using zip codes for geospatial analysis (2019)

#107
post #30

Earlier quoted context omitted.

> The consequence is that performing any analysis with an assumption that ZIP codes are polygons is bound to be error-prone. Yeah, but any analysis you're likely to perform is approximate enough that the fact that ZIP codes aren't polygons is basically a rounding error. Plus, it's a lot easier to get ZIP codes, and they're more reliably correct, so you might still get better results, than you would going with another…

They aren’t reliable correct actually. The boundaries that the Census publishes are called Zip Code Tabulation Areas which are approximations of zip codes and include overlaps.

ZCTA5 roughly corresponds to the area of a 5 digit zip code. Problem is there are large areas of the west that don’t have permanent residents and no mail delivery. Plus they change over time.

Re: Stop using zip codes for geospatial analysis (2019)

#108

Earlier quoted context omitted.

Zip codes (in the US) are machine readable numbers a mail sorter can use to send a parcel to the right delivery truck for final delivery. In the US, they represent the hierarchy of postal centers with the most significant digit representing the primary hub for a region and the smallest number the actual post office that will be in charge of delivering the letter (or truck if you do the extended post code). They don't…

I agree that they weren't explicitly meant to represent geography, but implicitly they do, right? Are there cases where this is violated? In other words, is it safe to assume that for entity in a zip code is less than x distance away from the closest entity in the same zip code?

> less than x distance away

zip codes don't even need to be contiguous. It's a mail delivery route, not a polygon.

There are 5 cases where the assumption is violated:

- Non-contiguous areas

- Zip codes that are a single point (some big companies get their own zip with a single mailbox, e.g. GE in Schenectady, NY is zip 12345)

- Zip codes that are a single line (highway-based delivery routes)

- Overlapping boundaries (since mail routes are linear, choosing a polygon representation is arbitrary and often not unique in space)

- Residents of some zip codes are not stationary (e.g. houseboats)

In short, asking questions about the area of a zip code is a category error - zip codes do not have a uniform representation in space. And we should be highly skeptical of any geospatial analysis that assumes polygons.

Re: Stop using zip codes for geospatial analysis (2019)

#109

To put it in plain mathematical language, ZIP codes are not defined as polygons [0]. The consequence is that performing any analysis with an assumption that ZIP codes are polygons is bound to be error-prone. 0: https://manifold.net/doc/mfd8/zip_codes_are_not_areas.htm

That's not the important problem and there's a simple solution with ZCTAs.

The big problem is zip codes are defined in terms of convenient postal routes and aren't suitable for most geospatial analysis. Census units, as the article explains, are a much better choice.

Post reply on HN