TITLE: Geohashing in Ruby
AUTHOR: Eugene Wallingford
DATE: May 30, 2008 6:13 PM
DESC:
-----
BODY:
A while back I read
this xkcd comic,
which introduced the idea of geohashing, selecting a meet-up
location based on a date, the Dow-Jones Industrial Average,
and MD5 hashing. Last month I ran across
this wiki page
on geohashing, which offers a reference implementation in
Python. That's fine, even with all those underscores, but
I decided to write a Ruby implementation for kicks. In
particular, I had never worked with Ruby's
MD5 digests
and was glad to have a reason.
So, during a few stolen moments at the
roadshow workshop
(summary soon...), I knocked off an implementation. Here's
my code.
It's very simple and can certainly be improved. I tried
to use idiomatic Ruby where I knew it, but some bits feel
awkward. In other places, I mimicked the reference
implementation perhaps too closely, so they still feel
Python-y. Please
send me
your suggestions!
-----