Geohash

For example, the coordinate pair 57.64911,10.40744 (near the tip of the peninsula of Jutland, Denmark) produces a slightly shorter hash of u4pruydqqvj.

The main usages of Geohashes are:

As a unique identifier. To represent point data, e.g. in databases. Geohashes have also been proposed to be used for geotagging.

Geohash is a hierarchical spatial index. This means that to represent a point, the world is recursively divided into smaller and smaller grids, with each additional bit, until the desired precision is attained.

To create a Geohash for our point (shown as a Red dot), let’s first divide the world into two halves with a vertical line and give each half a binary value of either 0 or 1.At our desired precision, our Geohash will look like a long binary string:

01010101101010101010101010111

Finally, we encode the resulting binary sequence as alphanumeric characters (Base-32 alphabet encoding is used where characters can be 0 to 9 and A to Z, excluding A”, I”, L” and O”).

Each 5 bits is converted to one character that looks something like ttnfv2u.

Created from: Algorithms to know before system design interviews 202211231052


uid: 202211231053 tags: #algorithms #software-engineering


Date
February 22, 2023