ConfigsMay 14, 2026·3 min read

H3 — Hexagonal Hierarchical Geospatial Indexing System

A hierarchical geospatial indexing system using hexagonal cells, developed by Uber for spatial analysis at scale.

Introduction

H3 is a geospatial indexing system that partitions the globe into hierarchical hexagonal cells at 16 resolution levels. Originally built at Uber for ride pricing, ETAs, and supply modeling, it provides a uniform grid that avoids the distortion artifacts of square grids near the poles.

What H3 Does

  • Indexes any latitude/longitude coordinate into a hexagonal cell at a chosen resolution (0-15)
  • Traverses the hierarchy: parent, children, and compact/uncompact operations across resolutions
  • Computes neighborhoods: k-ring (grid disk), grid distance, and grid path between cells
  • Converts between H3 indexes and boundary polygons for rendering on maps
  • Supports polyfill to find all H3 cells covering a given polygon geometry

Architecture Overview

The core library is written in C for performance and portability. Bindings exist for Python (h3-py), JavaScript (h3-js), Java, Go, and Rust. H3 uses an icosahedral face-centered projection, subdividing each face into hexagons (with 12 pentagons at vertices). Each cell is identified by a 64-bit integer encoding its resolution and position, enabling fast bitwise operations for traversal.

Self-Hosting & Configuration

  • Install language-specific bindings: pip install h3, npm install h3-js, or use the C library directly
  • No server or API key needed; H3 is a pure computation library
  • Choose resolution based on your use case: res 9 (~0.1 km²) for city-level, res 7 (~5 km²) for regional
  • Use with PostGIS via the h3-pg extension for spatial SQL queries on hexagonal grids
  • Integrate with deck.gl H3HexagonLayer or Kepler.gl for browser-based hex visualization

Key Features

  • Uniform cell areas at each resolution for unbiased spatial aggregation
  • 16 resolution levels from continental (res 0, ~4M km²) to sub-meter (res 15)
  • Hierarchical containment: every child cell nests within its parent
  • Edge and vertex indexing for modeling adjacency and connectivity
  • Compact representation reduces storage by replacing groups of children with parents

Comparison with Similar Tools

  • S2 Geometry (Google) — uses square cells on a sphere; H3 hexagons provide more uniform neighbor distances
  • Geohash — rectangular cells with edge-sharing artifacts; H3 hexagons share edges uniformly
  • PostGIS grid functions — arbitrary grids on projected data; H3 provides a standardized global hierarchy
  • Uber's Placekey — built on H3 for POI identification; H3 is the lower-level spatial index underneath
  • Open Location Code (Plus Codes) — encodes locations as short strings; H3 is optimized for spatial analytics

FAQ

Q: Why hexagons instead of squares? A: Hexagons have uniform adjacency (every neighbor shares an edge, not just a corner), which eliminates directional bias in distance calculations and spatial smoothing.

Q: How do I visualize H3 cells on a map? A: Convert cell indexes to GeoJSON boundary polygons with cell_to_boundary, then render with Leaflet, Mapbox GL, or deck.gl's H3HexagonLayer.

Q: Can H3 be used in SQL databases? A: Yes. The h3-pg extension brings H3 functions to PostgreSQL/PostGIS. DuckDB and ClickHouse also have H3 extensions.

Q: What is the performance like for large datasets? A: H3 operations are O(1) per cell using bitwise index arithmetic. Polyfilling a polygon scales with the number of cells it covers, which is efficient at appropriate resolutions.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets