Hacker News new | ask | show | jobs
by daviddahl 3846 days ago
The dataset of all towns in the world with > 1000 inhabitants is bundled into Kloak. The GPS location was originally highly accurate, but we rounded down to 2 decimal places. So if your GPS coordinates match the center of the city (rounded down), a place name can be generated. It basically will place you near the center of the closest town, again, its naively rounded to 2 decimal places. I want to go back to make this code a bit more sophisticated, with more choices for the user.
1 comments

Yea just rounding the coordinates is problematic at high latitudes. Curiously, the problem of finding a "nice" quantization set on the sphere is a well known mathematical problem called Spherical Coding [1]. But you don't need anything this fancy I guess, you can just round the coordinates if the latitude is less than e.g. 60 degrees , and if above you chose another pole and round the coordinates with respect to the second pole. It would probably be a good idea to add some hysteresis as suggested below too (so you're not localizable when you're at one of the edges). Then you can give it some fancy name like "Advanced location privacy protection" :)

http://mathworld.wolfram.com/SphericalCode.html

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