Friday, September 17, 2010


On the Thai blog of geography professor Phisan Santitamnont I stumbled over a posting on a new way to encode geographical locations named Geohash, advertised as the "ultimate Geocode". As I do some geocoding both for my private photos as well as for the administrative offices within my Tambon project, I found a good description in the Wikipedia article on Geohash.

It turns out that it is yet another way to encode a geographical coordinate into alphanumeric characters, bearing a few similarities with the UTM and MGRS coordinates. But other than those it does no complicate mathematics to make the geoid flat for having simple linear coordinates, it simply encodes the angular coordinates into binary code, which then is converted into characters using a base32 algorithm, similar with how binary data is sent in email. Nothing difficult for a programmer, so I have added a C# class into my coding project already.

Basically, the Geohash is a very compact but still readable way to encode a coordinate, a bit like those URL shortening one has to use in Twitter to keep the tweets within the 140 characters. For example w4rqn6k89ysst is the most accurate location for the Bangkok Noi district office. The length of the code depends on how much accurate one wants it to be, for 8 characters the error is about 20 meter, if cutting the last character the code stays valid but has then an error of 80 meter - actually the error is in arcseconds so the actual length differs on the location on the globe. Another good point is that the algorithm is completely in the Public Domain, as there is already a similar approach being patented - one of the infamous software patents.

Now while this Geohash is a nice thing, I doubt I'd be able to use it anywhere - within my XMLs I use the W3C standard to encode the locations, and all of the government publications use UTM anyway. Besides, these hash codes aren't really human readable, whereas the standard angular coordinates in XML are.

No comments: