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

It assumes the Earth is a sphere, also the code is not designed to work well towards the poles, at latitudes less or more than -/+ 85.


I work on a system that uses GPS data to figure out some metrics about roads. At that scale, the spherical model was not a useful approximation. It's been useful for drawing on top of Google Maps, but that's obviously because Google Maps chose it to keep straight lines rectilinear. The spherical model is a visually convenient model, but I don't think you can really do any serious calculations with it.


Redis Geo commands are mainly intended to solve the specific problem of indexing points into the earth and querying by radius. In this setup, the error we have currently is around 0.5% because Earth is not actually a sphere, but the good news is that fixing it should be just a very simple matter of using a more accurate distance formula: http://www.movable-type.co.uk/scripts/latlong-vincenty.html

Since anyway the bounding boxes we calculate and the resulting areas we scan are larger than needed, so all the actual precision is in the filtering function that removes points outside the radius.

TLDR: It will be trivial to fix that later in a backward compatible way. Btw adding an item in my TODO in order to check if I can do it right now without compromising performances.


Having done both Spherical Mercator and Universal Transverse Mercator in my own code, UTM is something like 25 times as many arithmetic operations as Spherical. That's not to say I have the most ideal implementation, though.


I think the parent post was asking if you could swap out the default sphere for another. Like, Mars. That way this could be used for geo queries on any planet.

Or is it just assuming that the earth is a perfect sphere?


The latter. Very few people need precise geolocation on Mars or any other non-Earth planet. But planets are not perfect spheres (mainly due to rotation), so treating them as such introduces errors.

If you're curious about the topic, you can start here: https://en.wikipedia.org/wiki/World_Geodetic_System.




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

Search: