H3 is an open-source spatial index developed by Uber that divides the Earth’s surface into a hierarchical grid of hexagonal cells. Each cell has a unique identifier, allowing locations and aggregations to be referenced through compact integer codes rather than precise coordinates.
What is H3?
H3 partitions the globe into 122 base cells at its coarsest resolution (resolution 0), with each cell subdivided across 16 finer resolution levels. At resolution 15, individual cells are roughly 1 square meter. The grid is hexagonal because hexagons offer two analytical advantages over squares or triangles:
- Uniform neighbor distance: every cell has six neighbors and they are all the same distance away. This makes algorithms that depend on proximity (clustering, smoothing, gradient calculations) more accurate and avoids the diagonal-vs-orthogonal distance problem of square grids.
- Better visual approximation of curves and natural features: hexagons reduce the visual distortion of linear features like roads or coastlines compared to square grids.
H3 cells are not perfectly congruent (the math doesn’t work to tile a sphere with identical hexagons), so resolution 0 includes 12 pentagonal cells. For most practical purposes, this irregularity is negligible.
Why H3 Matters
Traditional spatial operations require geometry-to-geometry comparisons that scale poorly with data size. H3 collapses each location into an integer cell ID, replacing expensive geometric joins with simple integer joins. This makes several operations practical at scale that are otherwise out of reach:
- Massive aggregation: billions of GPS pings or transactions can be summarized at any resolution by grouping on the cell ID.
- Fast spatial joins: joining two large datasets becomes an integer-equality match instead of a geometric intersection test.
- Multi-resolution analysis: H3 cells are hierarchical, so an analyst can drill down from country-level aggregates to neighborhood-level detail without re-aggregating from raw data.
This works because each H3 cell is a compact code, a short string rather than a complex geometry. A location or region becomes a lightweight, portable identifier that a cloud data warehouse can store, index, and join like any other column. Traditional desktop GIS had to process heavy geometry objects that were slow and hard to scale. H3 makes geospatial analysis a first-class citizen in the warehouse, with performance and scale that older GIS environments could not reach.
Common H3 Operations
- Polyfill: covering an arbitrary polygon with H3 cells at a chosen resolution
- K-ring: finding all cells within a given step distance from a center cell, useful for proximity analysis
- Compaction: merging adjacent same-resolution cells into coarser parent cells where possible, reducing storage cost
- Ring-distance smoothing: averaging values over surrounding cells to remove noise from sparse data
H3 in CARTO
CARTO supports H3 natively across the major cloud data warehouses through the Analytics Toolbox. Analysts can polyfill geometries into H3 cells, enrich them with data from the Data Observatory, and build visualizations at scale directly inside BigQuery, Snowflake, Databricks, Redshift, and Oracle using Spatial SQL.
H3 adoption reaches well beyond CARTO. A growing number of cloud data warehouses build native H3 functions into their platforms, which has made H3 a de facto standard for cloud-native geospatial analysis.
For a deeper introduction, the Spatial Indexes 101 report (low-code edition) covers H3 and Quadbin with practical examples.
H3 vs Other Spatial Indexes
H3 is one of several spatial indexing systems. The main alternatives are Quadbin (a square Mercator-based quadtree, simpler and natively supported by web mapping libraries) and S2 (Google’s spherical grid, used internally by BigQuery). H3 is generally preferred when proximity analysis or multi-resolution aggregation matters; Quadbin aligns naturally with raster and imagery data, so it is often the better choice when faster enrichment and rendering of raster or imagery sources is the priority.



