Version: 4.x (release candidate)

Indexing functions

These functions are used for finding the H3 cell index containing coordinates, and for finding the center and boundary of H3 indexes.

latLngToCell​

H3Error latLngToCell(const LatLng *g, int res, H3Index *out);

Indexes the location at the specified resolution, returning the index of the cell containing the location. This buckets the geographic point into the H3 grid. See the algorithm description for more information.

Returns 0 (E_SUCCESS) on success.

cellToLatLng​

H3Error cellToLatLng(H3Index cell, LatLng *g);

Finds the center of the cell in grid space. See the algorithm description for more information.

The center will drift versus the centroid of the cell on Earth due to distortion from the gnomonic projection within the icosahedron face it resides on and its distance from the center of the icosahedron face.

Returns 0 (E_SUCCESS) on success.

cellToBoundary​

H3Error cellToBoundary(H3Index cell, CellBoundary *bndry);

Finds the boundary of the cell. See the algorithm description for more information.

Returns 0 (E_SUCCESS) on success.