Geohashing

Summer seems to have arrived, at last.

As you may have noticed, today’s comic contains an algorithm for converting dates into local coordinates. For a given day, you can calculate what that day’s coordinate is for your region. Dan has put together a tool for calculating a day’s coordinates and show it using Google Maps. Note that you can’t calculate a day’s coordinates before the stock market opens on that day (about 9:00 EST) — except for weekends and holidays, when it uses the most recent opening price.

We’ve been having fun trying to reach these coordinates for some time now, when the coordinate is reachable — that is, when it’s not over water, in a military base, or in the middle of Bill Gates’s house.

If you happen to be looking for somewhere to go, driving to the coordinates can be an adventure. If you do, please take pictures and drop them on the geohashing wiki (feel free to help fill it out).  I’m gonna get some rest and then, at 10 AM tomorrow, see if I can get to the Boston coordinates (I have no way of knowing where they’ll be until then, of course).

And finally, when the coordinates are reachable, meetups are Saturday afternoon at 4:00.

Edit: I answered a bunch of questions in a comment below.  Further discussion is also happening on the wiki. I’m going to get some sleep and then head out to today’s coordinates (or as close as I can get).

586 replies on “Geohashing”

  1. I tested it, and the map lookup linked to in the comic includes the dashes in the calculation of the md5. See all NYCers this Saturday! Except those of you living in Manhattan in the area formed surrounded by the Hudson on one side and the line between the intersection of 43rd and 12th and the intersection of Dover St. and FDR on the other.

    Like

  2. http://irc.peeron.com/xkcd/map/ doesn’t seem to know today’s opening dow, but http://www.cnbc.com/id/15837290?q=.DJIA does. That makes today’s string “2008-05-21-12824.94” and the md5sum 2df19d4fe7daa520dc8d9fc5d4ed0711, which by my calculations puts the Boston location Randall should have been at 12 minutes ago as http://maps.google.com/maps?f=q&hl=en&geocode=&q=42.179467994697783+-71.861480496196977&ie=UTF8&ll=42.346365,-71.486664&spn=0.767324,1.163177&z=10 . And that is too far away for me to goto without some kind of confirmation.

    Like

  3. Cogito: Try turning on debugging info on the geohashing tool and see what you have to do to get the same results.

    Like

  4. >Anyone near southern Alabama? As in the Dothan area?

    Panama City here…Will you be participating???

    Like

  5. Apparently the map calculator isn’t working.
    I wrote a python script though, and looked at the dow jones site…
    42.179468°, -71.861536° for boston area I think.

    Like

  6. How do I get the specific coordinates for today from say, Boston? I click on Boston and I just get a pink box, w/ no coordinates.

    Does Randall still intend for us to do the algorithm ourselves? Cause I’m one of the uninitiated and have no clue was md5 is.

    Like

  7. this is amazing. have you noticed that in the square thingy (graticle?) for boston it hasn’t been in the actual city for this whole month? i need to start saving money for a goddamn car now so that i can drive out.

    Like

  8. So anyone in bath/corning area of NY? just wondering. it’s in the country so let’s bring sandwiches!!

    Like

  9. The issues with graticules and hour drives are fairly easily solved with a slightly generalized form of the algorithm. The division into whole degrees is arbitrary, and could as easily be some other size. To wit, if you wanted to make a hash to generate a point from 40.4, -80 to 40.5, -80.1, you just scale the two random [0,1) numbers down a factor of 10. Of course, you have to arrange what the box is beforehand (or rectangle, if you scale one more than the other), but then you can fit it over your city, metro area, or such.

    Like

  10. “S.B. Says:

    Hello Amerika, here is Switzerland calling.”

    I think you got the wrong number. Try Germany, Norway or the Czech Republic, plenty to choose from.

    Like

  11. This is just SCREAMING for an iPhone application. The app would use the “Locate Me” feature that Google Maps uses for its pseudo-GPS (there’s an API for that, I believe), grab the stock data (how does the finance widget obtain that data?…hmmm…), calculate the day’s coordinate, and stick a pin in the Google Maps app with that location (there’s an API for that, too!)

    Like

  12. Well damn. I live in central Sydney, Australia, and today’s result puts me square in the ocean. A fair way out, too.

    … I think I’ll pass, thanks.

    Like

  13. WOW i might do this on saturday 😀 tho im in hastings which is coastal so i could just get lame seaward ones…. unless anyone feels like meeting on the ferry, because its route is very near to todays co ord lol

    Like

  14. Wow, the only weekend it was anywhere near me was in the beginning of March. Hope the DOW is nice and puts one near me soon 🙂

    Like

  15. By the way, have you given any thought how insecure this system is? Whatever could happen if raptors get to know about this and they start to stalk xkcd staff and visitors. You guys better watch out with your meetings! 😉

    Like

  16. Question if you get this Randall
    there are a few graticule’s in the Boston area, and being from Boston i checked today’s location. the main Boston location gives you Auburn MA – just outside of worcester – 60 miles away, give or take. If you use the South Shore’s graticule, you end up in Weymouth – 5 miles away. how do you choose?

    Like

  17. Randall, this is obviously awesome but is there any way to set it up so the 1 by 1 box can be centered somewhere other than XX^30′ YY^30′ ?

    That would solve the ackward-city problem. Each town would have a box generated centered on itself.

    Just one decimal place of leeway after the lat/long degree would do it, I think.

    Like

  18. Nice job, Randall–you just broke a piece off Manhattan–and joined it with ***New Jersey***…

    Like

  19. > So, uh, it requires your starting co-ordinates. Doesn’t this mean that if people don’t use the same starting location we’ll all end up in different places?

    I declare the starting co-ordinates to be the ones for City Hall in the nearest town/city/megopolis

    Like

  20. So who wants to create a plot of the past locations to verify the randomness of this algorithm? Also, maybe we can start presenting the value of stocks over time this way.

    (Note that you’d have to just plot it within an arbitrary rectangle, but you could make some interesting 3D plots)

    Steve

    Like

  21. Hey guys, I am also having trouble with the location in my city (Lima, Peru) since it is divided in four sections, and each of them is basically ocean or mountains.
    So I came up with an idea, I hope it’s not too complicated.
    Instead of using those area squares based on round lat/lon coordinates, there could be a database for the most accurate square for each city and it’s sorroundings. Then the algorithm would use the already created offset to find a proportional offset from the center of the square. If your city is not registered in the database you could be the first to register it and set its center coords, or maybe the coords could be obtained from some geographic website for each city (major cities at least)

    Like

  22. Jimmy, good point about the South Shore spot being much closer than the main Boston one. Oddly, both are on a Prospect Street…

    Like

  23. Everybody’s huffy about having to drive, hike, and swim too far. I’m pretty sure the point of this isn’t to organize daily and weekly meetings. If it was, it’d be easier just to find a reasonable place than generate one randomly. It’s an algorithm for adventure! If your graticule sucks, go to a nearby one. If you can’t make it to the meet up spot because it’s too far or unreachable, go play frisbee and see if it’s a better spot next week. If the location is in an army base… well I think that’s extra incentive to get everybody to go.

    Like

  24. @Alex

    Is that Hastings UK? If so im in Brighton and experiencing the same issue, I may go for the graticule above if the one for Saturday ends up in the channel.

    Like

  25. The coordinates for today are only three miles from a local biker bar known for nightly brawls and with a spectacular view of the Mississippi river. Who’s comin’ with me?

    Like

  26. Hahha clicking on Calgary on May 21, it goes a little north of a place called Morely, a little town on the Indian reservation up here where I used to go when I was little for early morning hockey practices!
    Once again, XKCD makes my day!

    Like

  27. today’s meetup is easy (if a ways north) for the Hollywood/Los Angeles folks. I don’t have GPS, but if Google Maps is accurate, it’s in the middle of an intersection that’s bound to be busy at 4pm, but I’m sure we could figure out the crosswalks.

    Like

  28. Two questions:

    1. Why not go to the nearest meetup rather than the one in your graticule? San Diego’s is mostly ocean, so it’s quite likely that the meetups in neighboring graticules would be physically closer to San Diego.

    2. Why not include the graticule coordinates in the hash? That way, each graticule’s destination would be in a different relative location.

    Like

  29. This is pretty awesome, and what a great way to meet people! My box is mostly western Wisconsin, including Eau Claire. Anyone in that general area?

    Like

  30. Oooh, spooky! Today’s location in Wiltshire, England is a stone’s throw (ha ha) from Stonehenge 😐

    Like

  31. “Oooh, spooky! Today’s location in Wiltshire, England is a stone’s throw (ha ha) from Stonehenge :|”

    The aliens have comprimised the algorithm, and they’re coming to get you there.

    Like

  32. oooh. Fun. But weird. And because I live so close to the greenwich meridian, the longitudinal coords reflect about my location when i select the two closest map regions. hey somedays I should be able to do two in one go.

    Like

  33. For everyone complaining about awkward graticules, I’ve generalized the algorithm for an arbitrary parallelogram. If A is the south-western corner, B the north-western corner, and C the south-eastern corner, then once you have the two random numbers from the hash (once you’re at the step where you’ve converted the two hex numbers into decimal), then your location is given as follows: latitude of A + (1st random number)(latitude of B – latitude of A) + (2nd random number)(latitude of C – latitude of A), longitude of A + (1st random number)(longitude of B – longitude of A) + (2nd random number)(longitude of C – longitude of A)

    For example, if you want to geohash Central Park on May 9, 1990 (my birthday), you’d go to 40.796303, -73.951414, which, ironically enough, is in the middle of one of the lakes in the park.

    Like

  34. While i like the idea, i unfortunately live in Israel, where this algorithm completely fails. The odds that a point will fall inside Israel, in a safe place, are rather slim.

    Any ideas on how to adapt the algorithm to a general shape rather than a cube?

    Like

  35. What is cool about the cell I live in (34, -118, Central Los Angeles), is that it covers four distinct regions: the Basin, the Valley, the mountains, and the Mojave desert.

    Like

  36. I should point out that in my algorithm, there are multiple options about when to truncate (in order to keep your coordinates to 6 decimal places). I recommend truncating at the very end, since truncating beforehand could limit possibilities or create a need to truncate again.

    Like

  37. “2. Why not include the graticule coordinates in the hash? That way, each graticule’s destination would be in a different relative location.”

    A nice feature of the current setup is that, theoretically, there is a meet-up one degree north, one degree south, one degree east, and one degree west of your current meet-up. Including the graticule coordinates would change this.

    Like

Comments are closed.