Skip to main content
4 min read
Spatial Data · Foundational ·

H3 Hexagonal Grid System

H3 is Uber's open-source hexagonal hierarchical geospatial indexing system. It divides the Earth into a multi-resolution grid of hexagonal cells, providing consistent spatial indexing for large-scale location analytics.

H3 is an open-source hexagonal hierarchical geospatial indexing system developed by Uber and released in 2018. It divides the entire surface of the Earth into a multi-resolution grid of hexagonal cells, each assigned a unique 64-bit integer index. H3 has become a standard tool in location intelligence, spatial analytics, and GeoAI because it solves several fundamental problems with traditional coordinate-based and rectangular-grid approaches.

Why Hexagons?

Hexagons have mathematical properties that make them superior to squares and triangles for spatial analysis:

Uniform adjacency — every hexagon has exactly six neighbours at equal centre-to-centre distances. Squares have four close neighbours and four more distant diagonal neighbours, creating an asymmetric distance metric that biases spatial statistics.

Efficient tiling — hexagons approximate circles better than any other polygon that tiles the plane, minimising the maximum distance from a cell’s centre to its boundary. This is critical for catchment and service-area analysis.

Reduced edge effects — hexagonal binning produces more robust density estimates than rectangular binning because the neighbourhood structure is more symmetric.

Compact indexing — the entire Earth can be covered at resolution 15 (hexagons ~1 m²) with fewer than 600 trillion cells — and the hierarchical structure means any cell’s parent cells at coarser resolutions are efficiently derivable.

Resolution Levels

H3 supports 16 resolution levels (0–15), each with roughly 7× finer cells than the previous:

ResolutionAvg. Cell AreaScale
0~4,250,000 km²Continental
4~1,770 km²Country / large region
7~5.16 km²City district
9~0.105 km²Neighbourhood block
11~0.0009 km²Building footprint
15~0.9 m²Sub-metre

The factor-of-7 relationship between levels means that each cell at resolution n is composed of exactly 7 cells at resolution n+1 (approximately — H3 uses pentagons at icosahedron vertices to handle spherical distortion, so the exact count varies near those 12 points).

Core Operations

import h3

# Convert lat/lng to H3 cell at resolution 9
cell = h3.latlng_to_cell(51.5074, -0.1278, 9)
# → '8910d05c4b7ffff'

# Get all 6 neighbours
neighbours = h3.grid_disk(cell, 1)

# Get parent cell at resolution 7
parent = h3.cell_to_parent(cell, 7)

# Get cell boundary as polygon coordinates
boundary = h3.cell_to_boundary(cell)

Practical Uses

Density analysis — aggregate millions of GPS points into H3 cells to produce smooth, unbiased density surfaces without rectangular-grid artefacts.

Spatial joins — instead of expensive point-in-polygon queries, convert geometries to H3 cells and use set intersection — orders of magnitude faster at scale.

ML feature engineering — H3 indices make excellent spatial features because they encode location at multiple resolutions simultaneously; a single cell index implies its parents at all coarser resolutions.

Routing and catchmentgridDisk(cell, k) returns all cells within k steps, providing an efficient spatial buffer without coordinate system projection.

H3 and WalkGrid

My WalkGrid project uses H3 at resolution 9 (neighbourhood-block scale) to partition a city into ~150,000 cells, each enriched with 49 data layers — Ordnance Survey terrain, Earth Observation land cover, OpenStreetMap amenities, and crowdsourced cycling routes. The H3 graph forms the backbone of a personalised active travel routing engine that generates millisecond-latency routes at city scale.

Similarly, MORPHEME uses H3 cell graphs to learn urban embeddings across 24 global cities — each hexagon becomes a node in a spatial GNN trained to quantify neighbourhood character from OpenStreetMap feature distributions.

Ecosystem

H3 has official bindings for Python, JavaScript, Java, Go, R, and Rust. It integrates with DuckDB (h3_latlng_to_cell), BigQuery, PostGIS (via h3-pg), and Apache Arrow. Most major geospatial cloud platforms now offer H3 natively.

Last updated 24 April 2026

Explore Further

Related Blog Posts