Anecdote on Haversine: in 1.6, MongoDB's built-in "geonear" was using non-spherical indexing, but I needed to get more accurate results in a project, so I queried 3 times more records and used Haversine afterward to sort records again, client-side. Here's the ruby code:<p><a href="http://gist.github.com/559482" rel="nofollow">http://gist.github.com/559482</a><p>Since then, MongoDB 1.7 has been released with spherical sort support (<a href="http://www.mongodb.org/display/DOCS/Geospatial+Indexing#GeospatialIndexing-TheEarthisRoundbutMapsareFlat" rel="nofollow">http://www.mongodb.org/display/DOCS/Geospatial+Indexing#Geos...</a>)
Why in the world would you use this when MySQL has almost proper geospatial support? It's far more efficient and less incorrect.<p>I swear - next time I'm going to get a R-Tree novelty account.
One of those things you never think about when reading a map or driving in a car, but it's the explanation behind why you fly all the way up past nova scotia when on a plane to europe.
Sphinx (<a href="http://sphinxsearch.com/" rel="nofollow">http://sphinxsearch.com/</a>) is really good at geo/spatial searches on MySQL data<p>Example: <a href="http://www.god-object.com/2009/10/20/geospatial-search-using-sphinx-search-and-php/" rel="nofollow">http://www.god-object.com/2009/10/20/geospatial-search-using...</a>
<rant>I've got a better idea: use postgis and get rid of mysql and its quirks.<p>Yep, I just reinstalled an old app yesterday, and for some unfathomable reason it loses communication with mysql at some point (it worked perfectly for what, 6 years?). Gosh, I hate mysql.</rant>