Live data from Hacker News

Stop using zip codes for geospatial analysis (2019)

carto.com

21–30 of 134 posts

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

#21
post #7

...and use H3 instead! https://h3geo.org/

Very different use case -- ZIPs/ZCTAs have some semblance of population normalization

If you care about that and have a data source, you can add, for example, population density per H3 cell as part of your analysis. That has the additional benefit of denoting the this quantity of interest explicitly, rather than some implicitly assumed correlation which may not be true.

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

#22
H3 is awesome here! What I don't think many people realize is that H3 cells and normal geographic data (like zips) are not mutually exclusive. You can take zip outlines, and find all the h3 cells within them and allocate your metric accordingly (population, income, etc).

This makes joining disparate data sources quite easy. And this also lets you do all sorts of cool stuff like aggregations, smoothing, flow modeling, etc.

We do some geospatial stuff and I wrote a polars plugin to help with this a while back [1].

[1] https://github.com/Filimoa/polars-h3

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

#23

Earlier quoted context omitted.

Very different use case -- ZIPs/ZCTAs have some semblance of population normalization

Not necessarily true. The population isn't balanced at all between many. Census units are.

Absolutely this. Use other Census areal units if you can and ZCTAs only if you have to.

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

#24
post #6

Instead of zip use the following? Use Addresses Use Census Units Use your own Spatial Index Why not lat, long?

It depends on if you want to model a point or an area. lat/lng gives you a point , but you often want an area to, for example, count how many people are in that area. A spatial index like H3 provides a grid of area units.

But so do lat long ranges.

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

#26

Earlier quoted context omitted.

Very different use case -- ZIPs/ZCTAs have some semblance of population normalization

If you care about that and have a data source, you can add, for example, population density per H3 cell as part of your analysis. That has the additional benefit of denoting the this quantity of interest explicitly , rather than some implicitly assumed correlation which may not be true.

Hey AJ, this is almost on topic, do you know of a more up to date version of the dataset you used on the blog post release for H3 v4.0.0 [1]? They stopped updating in Oct 2023. Thanks! [1] https://data.humdata.org/dataset/kontur-population-dataset

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

#28
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 something like Smarty[1] to validate and parse addresses.

[0]: https://stackoverflow.com/questions/2783155/how-to-distingui...

[1]: https://www.smarty.com/

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

#29

CGP Grey recently posted a video on Zip codes, "The Hidden Pattern in Post Codes": * https://www.youtube.com/watch?v=1K5oDtVAYzk

That's what I was thinking of earlier, the succinct version is "your address is where mail needs to go, the zip code is how to get it there". Or in other words, the zip code is the address(es) of the sorting centers and post offices to the destination.

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

#30

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

> 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 indicator that is either (a) less reliable or (b) less available.

Post reply on HN