# How Geohash works.

Geohash is a way of referring to any point on the earth with a single string of characters. It was invented in 2008 by Gustavo Niemeyer and GM Morton.

Geohash first splits the equator into 8 sections, each 45° of longitude wide. Then it splits the latitude into 4 sections, again each section 45° of latitude wide. This splits the world’s surface into these 32 regions.

These 32 regions are labelled, using the 10 digits 0-9 and 22 letters (omitting A, I, L and O).

It is easier to see what is going on if we draw these regions on the sort of flat map we are used to.

The single character Geohash reference 6 identifies much of Latin America. Australia spans codes Q and R and China is mostly code W.

For more precision we subdivide each of these large regions into smaller regions. Here we go down to level 2.

At level 3 you can see that Mysuru is in square tdn.

Precision

With 9  characters, location can be specified to just under 5 m, which is sufficient for most purposes. But with up to 13 characters, you can specify a location to within less than 5 mm.

How subdivisions are carried out

Level 1 splits a rectangular map of the earth into 32 rectangles 8 rectangles wide and 4 high. The splitting from Level 1 to Level 2 subdivides with new rectangles though this split is 4 rectangles wide and 8 high.

Subdividing from Level 2 to Level 3, the rectangles revert to 8 wide and 4 high. This alternating splitting is maintained throughout the levels. The result is that passing through 2 subdivisions a given area is split into 32 x 32 (ie 1024) subdivisions.

Z-shaped region labelling

Geohash regions are labelled in a Z-shaped order as shown.

This give the best fit in terms of closeness between the Geohash, (a one-dimensional structure) and the surface of the world (which is two-dimensional).