What a geohash is
A geohash encodes a latitude and longitude into a single short string of letters and digits. The trick is interleaving bits: the world is repeatedly cut in half, alternating between the longitude axis and the latitude axis, and each cut writes one bit. Groups of five bits become one base32 character.
Why it is useful
- Prefixes are spatial. Two points that share a long common prefix are physically near each other.
- Precision is adjustable. More characters mean a smaller, more precise cell.
- It maps to a one dimensional key, so a plain sorted index or a key value store can answer rough proximity queries.
The edge case to remember
Points right across a cell border can be far apart in string space even though they are physically close. A robust nearby search checks the central cell plus its eight neighbors, not just one prefix.
Key idea
A geohash flattens two dimensions into one sortable string where a shared prefix usually means physical closeness.