Skip to main content
Version: 3.x

Indexing functions

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

geoToH3

H3Index geoToH3(const GeoCoord *g, int res);

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 on error.

h3ToGeo

void h3ToGeo(H3Index h3, GeoCoord *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.

h3ToGeoBoundary

void h3ToGeoBoundary(H3Index h3, GeoBoundary *gp);

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