Pony: at the end of the new "MetaFilter users near this user" query slap an "order by miles ascending". Not a big deal. I just want to stalk people in order, s'all. (That's a pretty damned sweet feature, btw).
posted by popechunk to feature requests at 10:37 PM (30 comments total)
Actually, if anyone has ever done DBA work, the thing that is stopping me from sorting them by distance is that I can't quite figure out how to calculate distance within SQL.
Basically I want a query to say "select the 50 closest users to this user page person's lat/lon coordinates, and sort the results by distance." It doesn't have to be too technical, it's just figuring out the difference between one lat value and others, assuming the minimum distances between two are closest.
So far, I've figured out how to select a bunch of nearby users by just looking +/- 0.5 degrees lat/lon from one user, then I'm calculating distance in coldfusion using the Great Circle Distance formula. The problem is that in NYC, plus or minus half a degree is 400 people, and the sort is by user_id, since that's an easy db value to order on.
posted by mathowie at 10:45 PM on December 21, 2005