It is a self-study of GeoHash.
Geohashing is a method of encoding geographic coordinates (latitude and longitude) into a short string of characters. It works by repeatedly dividing the world into smaller grids and interleaving the binary representations of latitude and longitude, then converting the result into a base32 string.
A key feature is that locations that are geographically close tend to share a longer common prefix in their geohash, making it useful for spatial indexing, proximity searches, and efficient querying of nearby points.
GeoHash with odd number length are squares, while even number length are rectangles.
Learning video: https://www.youtube.com/watch?v=vGKs-c1nQYU https://www.youtube.com/watch?v=ASLPkpKKCw4
| Geohash Length | Width (m) | Height (m) |
|---|---|---|
| 1 | ~5,000,000 | ~5,000,000 |
| 2 | ~1,250,000 | ~625,000 |
| 3 | ~156,000 | ~156,000 |
| 4 | ~39,100 | ~19,500 |
| 5 | ~4,890 | ~4,890 |
| 6 | ~1,220 | ~610 |
| 7 | ~153 | ~153 |
| 8 | ~38.2 | ~19.1 |
| 9 | ~4.77 | ~4.77 |
| 10 | ~1.19 | ~0.596 |
| 11 | ~0.149 | ~0.149 |
| 12 | ~0.037 | ~0.019 |
My implementation of GeoHashing is written in TypeScript, using the Bun runtime.
To install dependencies:
bun installTo test:
bun testTo run:
bun run index.ts