Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


You can use those if they work for your application. One downside would be that you're storing 4 numbers compared to a single `int64` index with H3.

You also have to decide how you'll do that binning. Can bins overlap? What do you do at the poles? H3 provides some reasonable default choices for you so don't have to worry about that part of your solution design.


Lat/lon is in a spherical coordinate. It’s more complicated to do calculation.

Btw. I have a need recently to compute the shortest distance from a point to a line defined by two points, all in lat/lon. Anyone has any lead on how to do it?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: