Skip to main content
Version: 4.x (alpha)

Indexing

H3 is a hierarchical geospatial index. H3 indexes refer to cells by the spatial hierarchy. Every hexagonal cell, up to the maximum resolution supported by H3, has seven child cells below it in this hierarchy. This subdivision is referred to as aperture 7.

Hexagons do not cleanly subdivide into seven finer hexagons. However, by alternating the orientation of grids a subdivision into seven cells can be approximated. This makes it possible to truncate the precision within a fixed margin of error of an H3 index. It is also possible to determine all the children of a parent H3 index. Approximate containment only applies when truncating the precision of an H3 index. The borders of hexagons indexed at a specific resolution are not approximate.

This approximation allows for efficiently relating datasets indexed at different resolutions of the H3 grid. The functions for changing precision (h3ToParent, h3ToChildren) are implemented with only a few bitwise operations, making them very fast. The structure of the H3 index means that geographically close locations will tend to have numerically close indexes.

The hierachical structure can also be used in analysis, when the precision or uncertainty for a location needs to be encoded in the spatial index. For example, a point from a GPS receiver could be indexed at a coarser resolution when the precision of the signal is lower, or some cells could be aggregated to a parent cell when there are too few data points in each of the finer cells.


A parent hexagon approximately contains seven children

Hierarchical containment allows for use cases like making contiguous sets of cells "compact" with compactCells. It is then possible to uncompactCells to the same input set of cells.

Uncompacted (dense)Compacted (sparse)
California represented by 10633 uncompacted cellsCalifornia represented by 901 compacted cells

Links#