Version: 4.x (release candidate)

# Miscellaneous H3 functions

These functions include descriptions of the H3 grid system.

double degsToRads(double degrees);

double radsToDegs(double radians);

## getHexagonAreaAvgKm2โ

H3Error getHexagonAreaAvgKm2(int res, double *out);

Average hexagon area in square kilometers at the given resolution. Excludes pentagons.

## getHexagonAreaAvgM2โ

H3Error getHexagonAreaAvgM2(int res, double *out);

Average hexagon area in square meters at the given resolution. Excludes pentagons.

H3Error cellAreaRads2(H3Index h, double *out);

Exact area of specific cell in square radians.

## cellAreaKm2โ

H3Error cellAreaKm2(H3Index h, double *out);

Exact area of specific cell in square kilometers.

## cellAreaM2โ

H3Error cellAreaM2(H3Index h, double *out);

Exact area of specific cell in square meters.

## getHexagonEdgeLengthAvgKmโ

H3Error getHexagonEdgeLengthAvgKm(int res, double *out);

Average hexagon edge length in kilometers at the given resolution. Excludes pentagons.

## getHexagonEdgeLengthAvgMโ

H3Error getHexagonEdgeLengthAvgM(int res, double *out);

Average hexagon edge length in meters at the given resolution. Excludes pentagons.

## exactEdgeLengthKmโ

H3Error exactEdgeLengthKm(H3Index edge, double *length);

Exact edge length of specific unidirectional edge in kilometers.

## exactEdgeLengthMโ

H3Error exactEdgeLengthM(H3Index edge, double *length);

Exact edge length of specific unidirectional edge in meters.

H3Error exactEdgeLengthRads(H3Index edge, double *length);

Exact edge length of specific unidirectional edge in radians.

## getNumCellsโ

H3Error getNumCells(int res, int64_t *out);

Number of unique H3 indexes at the given resolution.

## getRes0Cellsโ

H3Error getRes0Cells(H3Index *out);

All the resolution 0 H3 indexes. out must be an array of at least size res0CellCount().

## res0CellCountโ

int res0CellCount();

Number of resolution 0 H3 indexes, which is defined as 122.

## getPentagonsโ

H3Error getPentagons(int res, H3Index *out);

All the pentagon H3 indexes at the specified resolution. out must be an array of at least size pentagonIndexCount().

Returns 0 (E_SUCCESS) on success.

## pentagonCountโ

int pentagonCount();

Number of pentagon H3 indexes per resolution. This is always 12, but provided as a convenience.

## greatCircleDistanceKmโ

double greatCircleDistanceKm(const LatLng *a, const LatLng *b);

Gives the "great circle" or "haversine" distance between pairs of LatLng points (lat/lng pairs) in kilometers.

## greatCircleDistanceMโ

double greatCircleDistanceM(const LatLng *a, const LatLng *b);

Gives the "great circle" or "haversine" distance between pairs of LatLng points (lat/lng pairs) in meters.

double greatCircleDistanceRads(const LatLng *a, const LatLng *b);