Skip to main content
Version: 4.x

H3 Index

Introduction

The H3 system assigns a unique hierarchical index to each cell. Each directed edge and vertex is assigned an index based on its origin or owner cell, respectively.

H3Index Representation

An H3Index is the 64-bit integer representation of an H3 index, which may be one of multiple modes to indicate the concept being indexed.

  • Mode 0 is reserved and indicates an invalid H3 index.
  • Mode 1 is an H3 Cell (Hexagon/Pentagon) index.
  • Mode 2 is an H3 Directed Edge (Cell A -> Cell B) index.
  • Mode 3 is planned to be a bidirectional edge (Cell A <-> Cell B).
  • Mode 4 is an H3 Vertex (i.e. a single vertex of an H3 Cell).

The canonical string representation of an H3Index is the hexadecimal representation of the integer, using lowercase letters. The string representation is variable length (no zero padding) and is not prefixed or suffixed.

Invalid Index

Mode 0 contains a special index, H3_NULL, which is unique: it is bit-equivalent to 0. This index indicates, specifically, an invalid, missing, or uninitialized H3 index; it is analogous to NaN in floating point. It should be used instead of an arbitrary Mode 0 index, due to its uniqueness and easy identifiability. A mode 0 index could also indicate an error code has been provided instead of a valid H3 index.

Bit layout of H3Index

The layout of an H3Index is shown below in table form. The interpretation of the "Mode-Dependent" field differs depending on the mode of the index.

0x0F0x0E0x0D0x0C0x0B0x0A0x090x080x070x060x050x040x030x020x010x00
0x30ReservedModeMode-DependentResolutionBase cell
0x20Base cellDigit 1Digit 2Digit 3Digit 4Digit 5
0x10Digit 5Digit 6Digit 7Digit 8Digit 9Digit 10
0x00Digit 10Digit 11Digit 12Digit 13Digit 14Digit 15