The Geohash algorithm is a useful way to describe locations on the earth using a single string of a-z, 0-9 characters. They can be thought of as rectangular subdivisions of the Earth’s surface. Learn more here: Geohash at Wikipedia. They were invented by Gustavo Niemeyer in 2008.
It’s good to get an idea of how large a rectangle a given geohash describes, but this changes depending on your latitude. At the equator, geohashes are biggest, so you need more characters to describe an area of a given size, or a location of a given precision.
In Cartagen I’m using geohashes to report geodata by text message, so it’s very useful to know how long your geohash code will be to describe, say, the area of a building, a soccer field, or a street corner. I did a quick calculation for the equator, which is the worst-case scenario:
Dimensions of geohashes of length n:
N | Longitude | Latitude | east/west distance at equator | north/south distance at equator |
---|---|---|---|---|
12: | 0.00000033527612686157227 | 0.00000016763806343078613 | ~3.7cm | ~1.8cm |
11: | 0.000001341104507446289 | 0.000001341104507446289 | ~14.9cm | ~14.9cm |
10: | 0.000010728836059570312 | 0.000005364418029785156 | ~1.19m | ~0.60m |
9: | 0.00004291534423828125 | 0.00004291534423828125 | ~4.78m | ~4.78m |
8: | 0.00034332275390625 | 0.000171661376953125 | ~38.2m | ~19.1m |
7: | 0.001373291015625 | 0.001373291015625 | ~152.8m | ~152.8m |
6: | 0.010986328125 | 0.0054931640625 | ~1.2km | ~0.61km |
5: | 0.0439453125 | 0.0439453125 | ~4.9km | ~4.9km |
4: | 0.3515625 | 0.17578125 | ~39km | ~19.6km |
3: | 1.40625 | 1.40625 | ~157km | ~157km |
2: | 11.25 | 5.625 | ~1252km | ~626km |
1: | 45 | 45 | ~5018km | ~5018km |
I think this is right but if you find an error please tell me. I put it up on the Cartagen Wiki here: GeoHashes
Update: if you want to know how big a geohash is near you, it’s a bit tough – it varies depending on what latitude you’re at. Someone ought to make a nice map of geohash sizes, like this one which is NOT to scale or using real values… it’s just a sketch:
Thanks for one’s marvelous posting! I actually enjoyed reading it, you can be a great author.I will always bookmark your blog and may come back in the future.I want to encourage continue your great job, have a nice day!
Nice intro ! but i’ll add there is no a, i, l, o in geohash string, (base32: 10 numbers and 22 letters)