Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Geohash

Geohash is a hierarchical spatial data structure that encodes geographic coordinates into a short alphanumeric string, enabling efficient indexing and proximity searches for virtual land parcels.
Chainscore © 2026
definition
GEOGRAPHIC ENCODING

What is Geohash?

A public domain system for encoding geographic coordinates into a short string of letters and digits.

A Geohash is a hierarchical spatial data structure that encodes a geographic location, defined by its latitude and longitude, into a short alphanumeric string. The system works by recursively subdividing the world into a grid of 32 cells, each assigned a character from a base-32 alphabet (0-9, b-z, excluding a, i, l, o). The length of the resulting string determines the precision of the location; each additional character adds approximately five more bits of precision, further narrowing the represented bounding box.

The core utility of Geohash lies in its prefix property. Because it is a hierarchical system, two locations that share a common prefix are geographically proximate. This allows for efficient proximity searches and spatial indexing in databases, as nearby points will often be sorted near each other in lexicographical order. For example, the Geohash u4pruyd corresponds to a specific area in central Oslo, while u4pru represents a larger bounding box that contains it.

Geohashes are widely used in applications requiring fast, approximate location queries, such as in NoSQL databases (e.g., Redis, MongoDB), real-time mapping services, and social media check-ins. However, a key limitation is that while points near each other often share a prefix, points on opposite sides of a cell boundary can have vastly different hashes despite being physically close—a phenomenon known as edge cases in proximity. Despite this, its simplicity and effectiveness make it a foundational tool for geospatial indexing.

how-it-works
GEOGRAPHIC ENCODING

How Geohash Works

Geohash is a public domain geocoding system that encodes a geographic location into a short string of letters and digits, creating a hierarchical spatial data structure.

A Geohash is a hierarchical spatial index that converts latitude and longitude coordinates into a single alphanumeric string. The core algorithm uses a base-32 encoding (using digits 0-9 and letters a-z, excluding a, i, l, o) to represent a bounding box on the Earth's surface. The precision of the location is determined by the length of the hash: a longer string denotes a smaller, more precise area. For example, the Geohash u4pruydqqvj represents a specific point in Oslo, Norway, while the shorter prefix u4p covers a much larger region of Scandinavia.

The encoding process works by interleaving the bits representing the latitude and longitude. The world is first divided into 32 rectangular cells, each assigned a character. The chosen cell is then recursively subdivided into 32 smaller cells, with each subdivision adding another character to the hash. This creates a Z-order curve (or Morton code) that preserves spatial locality—locations that are geographically close will often share a long common prefix in their Geohash strings. This property makes Geohash exceptionally efficient for proximity searches and spatial indexing in databases.

A key feature of the system is its inherent error tolerance and prefix search capability. If two locations share the same first n characters of their Geohash, they are guaranteed to be within a certain geographic distance of each other, defined by the precision of that prefix length. This allows for fast, approximate nearest-neighbor queries without complex geometric calculations. However, users must be aware of edge cases where two points on opposite sides of a Geohash cell boundary can be geographically close but have completely different hashes, a limitation inherent to any grid-based system.

key-features
SPATIAL INDEXING

Key Features of Geohash

Geohash is a hierarchical spatial data structure that encodes a geographic location into a short string of letters and digits, enabling efficient proximity searches and spatial indexing.

01

Hierarchical Encoding

Geohash uses a base-32 encoding scheme to convert latitude and longitude coordinates into a single alphanumeric string. The precision of the location is determined by the length of the hash: a longer hash represents a smaller, more precise area. For example, the hash u4pruydqqvj (11 characters) defines a specific building, while u4p (3 characters) defines a much larger region.

02

Proximity Search

A core feature is that nearby locations often share a common prefix. This allows for efficient proximity searches in databases. To find all points near a given location, you can simply query for other geohashes that start with the same prefix. For instance, all points within a few kilometers of a location with hash u4pruy will likely have hashes beginning with u4pru.

03

Z-Order Curve (Morton Code)

The algorithm works by interleaving the bits of the latitude and longitude coordinates, creating a Z-order curve (Morton order) that maps the 2D space into a 1D string. This curve preserves spatial locality, meaning points that are close in the 2D plane are also close on the 1D line, which is the fundamental property enabling fast spatial queries.

04

Bounding Box Representation

Each geohash string corresponds to a specific rectangular bounding box on the Earth's surface. The algorithm recursively subdivides the world into a grid. The first character divides the world into 32 rectangles, the second subdivides that rectangle into 32 more, and so on. A point is considered to be within the bounding box of its geohash.

05

Lossy Compression

Geohash is a lossy compression algorithm. The original latitude and longitude coordinates cannot be perfectly reconstructed from the hash; they are approximated to the center of the bounding box defined by the hash. The precision loss decreases as the hash length increases, with a 12-character hash being accurate to within a few millimeters.

06

Common Applications

  • Spatial Databases: Used by systems like Redis, MongoDB, and Elasticsearch for geo-indexing.
  • Proximity Services: Powers features like 'find restaurants near me' in mapping apps.
  • Data Aggregation: Enables grouping and analyzing data by geographic region at different zoom levels.
  • Decentralized Systems: Can be used in blockchain or peer-to-peer networks for location-based data sharding or discovery.
visual-explainer
SPATIAL INDEXING

Visualizing the Geohash Grid

A conceptual guide to understanding the hierarchical, grid-based structure of the Geohash spatial indexing system.

A Geohash grid is a hierarchical spatial data structure that recursively subdivides the Earth's surface into rectangular grid cells using a base-32 encoding of latitude and longitude coordinates. This system transforms any location into a short alphanumeric string, where each additional character increases the precision, zooming in on a smaller, more specific area. The core principle is z-order curve or Morton order encoding, which interleaves the bits of the latitude and longitude to create a single, one-dimensional value that preserves two-dimensional locality.

The visualization of this grid begins with the entire planet as a single cell. The first character of a Geohash divides the world into 32 rectangles (8 latitude bands by 4 longitude bands). For example, the character e represents a large area covering parts of Western Europe and North Africa. Adding a second character subdivides that e cell into 32 smaller cells, and so on. This creates a quadtree-like structure, but with rectangular cells whose aspect ratio changes with latitude—cells near the equator are more square, while cells near the poles become increasingly elongated.

This grid visualization is crucial for understanding Geohash's properties. Spatial proximity is generally preserved: locations with similar Geohash prefixes are physically near each other. This enables efficient proximity searches and spatial indexing in databases. However, the edges of the grid cells are arbitrary, so two points very close together but on opposite sides of a cell boundary will have completely different Geohash prefixes, a phenomenon known as the edge case problem. Despite this, the system's simplicity and the fact that it is a public domain algorithm have made it a widely adopted standard for geospatial applications.

ecosystem-usage
SPATIAL DATA STANDARD

Geohash in the Metaverse Ecosystem

Geohash is a public domain geocoding system that encodes geographic coordinates into a short string of letters and digits, enabling efficient spatial indexing and proximity searches. In the metaverse, it provides a foundational layer for organizing and querying persistent, location-based digital assets and experiences.

01

Core Mechanism: Hierarchical Spatial Grid

A Geohash is generated by interleaving the bits of latitude and longitude coordinates, creating a Z-order curve (or Morton code) that maps 2D space into a 1D string. The precision of the location is determined by the length of the hash:

  • 5 characters: ~2.4km accuracy.
  • 7 characters: ~76m accuracy.
  • 9 characters: ~2.4m accuracy. This hierarchical structure allows for fast proximity searches, as nearby locations often share a common prefix.
02

Primary Use Case: Spatial Indexing

In blockchain-based virtual worlds, Geohash serves as a primary key for organizing on-chain land parcels, assets, and event data. Platforms like Decentraland and The Sandbox use it to:

  • Index LAND tokens to specific coordinates.
  • Enable efficient queries for assets "nearby" a given location.
  • Create spatial databases where location is a first-class query parameter, drastically reducing the computational load for rendering and interaction in large-scale worlds.
03

Interoperability & Standardization

Geohash acts as a neutral, platform-agnostic standard for location, enabling cross-metaverse interoperability. Because it's a simple string derived from universal coordinates (latitude/longitude), different virtual worlds and mapping services can reference the same physical or conceptual space. This is foundational for projects building metaverse geospatial protocols that aim to connect disparate digital environments.

04

Technical Limitation: Boundary Cases

A key limitation of the Geohash algorithm is that locations near the 180th meridian (International Date Line) or the poles can have discontinuous hashes. Two points that are geographically adjacent may not share a common prefix if they fall on opposite sides of a Geohash cell boundary. Developers must implement boundary-aware queries, often checking the eight neighboring cells, to ensure complete spatial searches.

06

On-Chain Implementation

Storing and querying Geohashes on-chain requires smart contract patterns optimized for gas efficiency. Common approaches include:

  • Prefix Trees (Tries): Storing assets keyed by Geohash prefix for range queries.
  • Bounding Box Checks: Converting a Geohash back to its bounding box coordinates for overlap verification.
  • Layer-2 Scaling: Performing complex spatial queries off-chain (e.g., with a The Graph subgraph) and settling proofs or results on-chain. The immutable ledger ensures the permanent, verifiable anchoring of digital assets to a location.
REFERENCE

Geohash Precision & Cell Size

How Geohash length (precision) corresponds to geographic cell dimensions and typical use cases.

Geohash Length (chars)Latitude Error (±)Longitude Error (±)Cell Width at EquatorTypical Use Case

1

23°

23°

≈ 5,000 km

Continent / Large country

2

2.8°

5.6°

≈ 1,250 km

Large country / State

3

0.70°

0.70°

≈ 156 km

Metropolitan region

4

0.087°

0.087°

≈ 39.1 km

City / Large town

5

0.022°

0.022°

≈ 4.9 km

Town / Neighborhood

6

0.0027°

0.0055°

≈ 1.2 km

Neighborhood / Street

7

0.00068°

0.00068°

≈ 153 m

Individual street / Block

8

0.000085°

0.000085°

≈ 19 m

Individual building / Parcel

advantages-for-virtual-land
GEOHASH UTILITY

Advantages for Virtual Land Indexing

Geohash, a public domain geocoding system, provides a foundational spatial indexing method for organizing and querying virtual land parcels in metaverse platforms.

01

Hierarchical Spatial Indexing

Geohash encodes geographic coordinates into a short string of letters and digits, where each character adds precision. This creates a hierarchical grid where longer hashes represent smaller, more precise areas. For virtual worlds, this allows land parcels to be organized into a quadtree data structure, enabling efficient spatial queries like 'find all parcels within this district' by comparing hash prefixes.

02

Deterministic & Unique Parcel IDs

Each virtual land parcel's coordinates (e.g., (x, y) or (lat, lng)) produce a single, deterministic Geohash. This hash serves as a unique, immutable identifier for the parcel on-chain. It prevents duplicate claims for the same location and provides a verifiable proof of location that is easily stored in a smart contract or NFT metadata, linking digital asset ownership to a specific plot.

03

Proximity Search & Neighbor Discovery

A key advantage is efficient proximity search. Parcels with similar Geohash prefixes are geographically close. Systems can quickly find adjacent parcels or land within a radius by:

  • Calculating the Geohash for a center point at a desired precision.
  • Generating and querying for the hashes of the 8 neighboring grid cells. This is far more efficient than calculating Euclidean distances for every parcel in a database.
04

Data Compression & On-Chain Efficiency

Geohash compresses two floating-point coordinates (latitude/longitude) into a single, short alphanumeric string. This reduces on-chain storage costs and minimizes gas fees for transactions that record or verify land location. A 12-character Geohash (e.g., ezs42e44yx96) specifies a ~3.7cm x 1.9cm area, providing millimeter precision for virtual worlds while using less than 12 bytes of data.

05

Interoperable Spatial Standard

As an open, algorithm-based standard, Geohash provides an interoperable foundation for cross-platform virtual land. Different metaverse projects or mapping tools can use the same hash to reference an identical geographic area, facilitating cross-world portals, shared spatial data layers, and aggregated land indices. It acts as a common language for location, separate from any single platform's internal coordinate system.

06

Scalable Zoning & District Management

Platforms can use Geohash precision levels to define administrative zones. For example:

  • A 4-character hash might define a continent.
  • A 6-character hash defines a city district.
  • A 9-character hash defines an individual parcel. Smart contracts can enforce rules (e.g., building heights, allowed assets) based on the zone prefix, enabling scalable, code-defined land governance.
CLARIFYING THE BASICS

Common Misconceptions About Geohash

Geohash is a widely used geocoding system, but its simplicity often leads to misunderstandings about its precision, structure, and application. This section addresses the most frequent points of confusion.

A Geohash represents a bounding box (a rectangular area), not a single point. The Geohash string encodes a specific latitude/longitude range on Earth's surface. While often derived from a central point, the hash itself defines an area whose size depends on the hash's character length. For example, the Geohash u4pruyd defines a roughly 153m x 153m rectangle in central Oslo. Using it as a point can introduce significant error at the edges of the cell.

GEOHASH

Frequently Asked Questions (FAQ)

A Geohash is a public domain geocoding system that encodes a geographic location into a short string of letters and digits. This section answers common technical questions about its structure, precision, and applications.

A Geohash is a hierarchical spatial data structure that encodes a geographic coordinate (latitude and longitude) into a short alphanumeric string. It works by recursively subdividing the world into a grid of 32 cells, each assigned a character from a base-32 alphabet (0-9, b-z, excluding a, i, l, o). Each subsequent character in the hash adds another level of precision, further narrowing the represented bounding box. For example, the geohash u4pruydqqvj represents a specific point in Oslo, Norway. The longer the geohash string, the smaller and more precise the represented area becomes.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Geohash: Hierarchical Spatial Encoding for Virtual Land | ChainScore Glossary