Skip to main content
Version: 4.x

Directed edge functions

Directed edges allow encoding the directed (that is, which cell is the origin and which is the destination can be determined) edge from one cell to a neighboring cell.

areNeighborCells

Determines whether or not the provided H3 cells are neighbors.

H3Error areNeighborCells(H3Index origin, H3Index destination, int *out);

out will be 1 if the indexes are neighbors, 0 otherwise.

Returns 0 (E_SUCCESS) on success.

cellsToDirectedEdge

Provides a directed edge H3 index based on the provided origin and destination.

H3Error cellsToDirectedEdge(H3Index origin, H3Index destination, H3Index *out);

Returns 0 (E_SUCCESS) on success.

isValidDirectedEdge

Determines if the provided H3Index is a valid unidirectional edge index.

int isValidDirectedEdge(H3Index edge);

Returns 1 if it is a unidirectional edge H3Index, otherwise 0.

getDirectedEdgeOrigin

Provides the origin hexagon from the directed edge H3Index.

H3Error getDirectedEdgeOrigin(H3Index edge, H3Index *out);

Returns 0 (E_SUCCESS) on success.

getDirectedEdgeDestination

Provides the destination hexagon from the directed edge H3Index.

H3Error getDirectedEdgeDestination(H3Index edge, H3Index *out);

Returns 0 (E_SUCCESS) on success.

directedEdgeToCells

Provides the origin-destination pair of cells for the given directed edge.

H3Error directedEdgeToCells(H3Index edge, H3Index* originDestination);

The origin and destination are placed at originDestination[0] and originDestination[1], respectively.

Returns 0 (E_SUCCESS) on success.

originToDirectedEdges

Provides all of the directed edges from the current cell.

H3Error originToDirectedEdges(H3Index origin, H3Index* edges);

edges must be of length 6, and the number of directed edges placed in the array may be less than 6. If this is the case, one of the members of the array will be 0.

Returns 0 (E_SUCCESS) on success.

directedEdgeToBoundary

Provides the geographic lat/lng coordinates defining the directed edge. Note that this may be more than two points for complex edges.

H3Error directedEdgeToBoundary(H3Index edge, CellBoundary* gb);

Returns 0 (E_SUCCESS) on success.