Skip to main content
Version: 4.x

Index inspection functions

These functions provide metadata about an H3 index, such as its resolution or base cell, and provide utilities for converting into and out of the 64-bit representation of an H3 index.

getResolution

int getResolution(H3Index h);

Returns the resolution of the index.

getBaseCellNumber

int getBaseCellNumber(H3Index h);

Returns the base cell number of the index.

stringToH3

H3Error stringToH3(const char *str, H3Index *out);

Converts the string representation to H3Index (uint64_t) representation.

Returns 0 (E_SUCCESS) on success.

h3ToString

H3Error h3ToString(H3Index h, char *str, size_t sz);

Converts the H3Index representation of the index to the string representation. str must be at least of length 17.

Returns 0 (E_SUCCESS) on success.

isValidCell

int isValidCell(H3Index h);

Returns non-zero if this is a valid H3 cell index.

isResClassIII

int isResClassIII(H3Index h);

Returns non-zero if this index has a resolution with Class III orientation.

isPentagon

int isPentagon(H3Index h);

Returns non-zero if this index represents a pentagonal cell.

getIcosahedronFaces

H3Error getIcosahedronFaces(H3Index h, int* out);

Find all icosahedron faces intersected by a given H3 index and places them in the array out. out must be at least length of maxFaceCount(h).

Faces are represented as integers from 0-19, inclusive. The array is sparse, and empty (no intersection) array values are represented by -1.

Returns 0 (E_SUCCESS) on success.

maxFaceCount

H3Error maxFaceCount(H3Index h3, int *out);

Returns the maximum number of icosahedron faces the given H3 index may intersect.