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.
- C
- Java
- JavaScript (Live)
- Python
- Shell
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.
boolean areNeighborCells(long origin, long destination);
boolean areNeighborCells(String origin, String destination);
h3.areNeighborCells(origin, destination)
h3.are_neighbor_cells(origin, destination)
$ h3 areNeighborCells --help
h3: Determines if the provided H3 cells are neighbors (have a shared border)
H3 4.1.0
areNeighborCells Determines if the provided H3 cells are neighbors (have a shared border)
-o, --origin <CELL> Required. Origin H3 Cell
-d, --destination <CELL> Required. Destination H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for true or false, 'numeric' for 1 or 0 (Default: json)
$ h3 areNeighborCells -o 85283473fffffff -d 85283477fffffff
true
cellsToDirectedEdge
Provides a directed edge H3 index based on the provided origin and destination.
- C
- Java
- JavaScript (Live)
- Python
- Shell
H3Error cellsToDirectedEdge(H3Index origin, H3Index destination, H3Index *out);
Returns 0 (E_SUCCESS
) on success.
long cellsToDirectedEdge(long origin, long destination);
String cellsToDirectedEdge(String origin, String destination);
h3.cellsToDirectedEdge(h3Index)
h3.cells_to_directed_edge(origin, destination)
$ h3 cellsToDirectedEdge --help
h3: Converts neighboring cells into a directed edge index (or errors if they are not neighbors)
H3 4.1.0
cellsToDirectedEdge Converts neighboring cells into a directed edge index (or errors if they are not neighbors)
-o, --origin <CELL> Required. Origin H3 Cell
-d, --destination <CELL> Required. Destination H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for "CELL"\n, 'newline' for CELL\n (Default: json)
$ h3 cellsToDirectedEdge -o 85283473fffffff -d 85283477fffffff
"115283473fffffff"
isValidDirectedEdge
Determines if the provided H3Index is a valid unidirectional edge index.
- C
- Java
- JavaScript (Live)
- Python
- Shell
int isValidDirectedEdge(H3Index edge);
Returns 1
if it is a unidirectional edge H3Index, otherwise 0
.
boolean isValidDirectedEdge(long edge);
boolean isValidDirectedEdge(String edgeAddress);
h3.isValidDirectedEdge(edge)
h3.is_valid_directed_edge(edge)
$ h3 isValidDirectedEdge --help
h3: Checks if the provided H3 directed edge is actually valid
H3 4.1.0
isValidDirectedEdge Checks if the provided H3 directed edge is actually valid
-h, --help Show this help message.
-c, --cell <index> Required. H3 Cell
-f, --format <FMT> 'json' for true or false, 'numeric' for 1 or 0 (Default: json)
$ h3 isValidDirectedEdge -c 115283473fffffff
true
getDirectedEdgeOrigin
Provides the origin hexagon from the directed edge H3Index.
- C
- Java
- JavaScript (Live)
- Python
- Shell
H3Error getDirectedEdgeOrigin(H3Index edge, H3Index *out);
Returns 0 (E_SUCCESS
) on success.
long getDirectedEdgeOrigin(long edge);
String getDirectedEdgeOrigin(String edgeAddress);
h3.getDirectedEdgeOrigin(h3Index)
h3.get_directed_edge_origin(edge)
$ h3 getDirectedEdgeOrigin --help
h3: Returns the origin cell from the directed edge
H3 4.1.0
getDirectedEdgeOrigin Returns the origin cell from the directed edge
-c, --cell <index> Required. H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for "CELL"\n, 'newline' for CELL\n (Default: json)
$ h3 getDirectedEdgeOrigin -c 115283473fffffff
"85283473fffffff"
getDirectedEdgeDestination
Provides the destination hexagon from the directed edge H3Index.
- C
- Java
- JavaScript (Live)
- Python
- Shell
H3Error getDirectedEdgeDestination(H3Index edge, H3Index *out);
Returns 0 (E_SUCCESS
) on success.
long getDirectedEdgeDestination(long edge);
String getDirectedEdgeDestination(String edgeAddress);
h3.getDirectedEdgeDestination(edge)
h3.get_directed_edge_destination(edge)
$ h3 getDirectedEdgeDestination --help
h3: Returns the destination cell from the directed edge
H3 4.1.0
getDirectedEdgeDestination Returns the destination cell from the directed edge
-c, --cell <index> Required. H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for "CELL"\n, 'newline' for CELL\n (Default: json)
$ h3 getDirectedEdgeDestination -c 115283473fffffff
"85283477fffffff"
directedEdgeToCells
Provides the origin-destination pair of cells for the given directed edge.
- C
- Java
- JavaScript (Live)
- Python
- Shell
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.
List<Long> directedEdgeToCells(long edge);
List<String> directedEdgeToCells(String edgeAddress);
h3.directedEdgeToCells(edge)
h3.directed_edge_to_cells(edge)
$ h3 directedEdgeToCells --help
h3: Returns the origin, destination pair of cells from the directed edge
H3 4.1.0
directedEdgeToCells Returns the origin, destination pair of cells from the directed edge
-c, --cell <index> Required. H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for ["CELL", ...], 'newline' for CELL\n... (Default: json)
$ h3 directedEdgeToCells -c 115283473fffffff
["85283473fffffff", "85283477fffffff"]
originToDirectedEdges
Provides all of the directed edges from the current cell.
- C
- Java
- JavaScript (Live)
- Python
- Shell
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.
List<Long> originToDirectedEdges(long h3);
List<String> originToDirectedEdges(String h3);
h3.originToDirectedEdges(h3Index)
h3.origin_to_directed_edges(h)
$ h3 originToDirectedEdges --help
h3: Returns all of the directed edges from the specified origin cell
H3 4.1.0
originToDirectedEdges Returns all of the directed edges from the specified origin cell
-c, --cell <index> Required. H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for ["CELL", ...], 'newline' for CELL\n... (Default: json)
$ h3 originToDirectedEdges -c 85283473fffffff
["115283473fffffff", "125283473fffffff", "135283473fffffff", "145283473fffffff", "155283473fffffff", "165283473fffffff"]
directedEdgeToBoundary
Provides the geographic lat/lng coordinates defining the directed edge. Note that this may be more than two points for complex edges.
- C
- Java
- JavaScript (Live)
- Python
- Shell
H3Error directedEdgeToBoundary(H3Index edge, CellBoundary* gb);
Returns 0 (E_SUCCESS
) on success.
List<LatLng> directedEdgeToBoundary(long edge);
List<LatLng> directedEdgeToBoundary(String edgeAddress);
h3.directedEdgeToBoundary(edge, [formatAsGeoJson])
h3.directed_edge_to_boundary(edge)
$ h3 directedEdgeToBoundary --help
h3: Provides the coordinates defining the directed edge
H3 4.1.0
directedEdgeToBoundary Provides the coordinates defining the directed edge
-c, --cell <index> Required. H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for [[lat, lng], ...], 'wkt' for a WKT POLYGON, 'newline' for lat\nlng\n... (Default: json)
$ h3 directedEdgeToBoundary -c 115283473fffffff
[[37.4201286777, -122.0377349643], [37.3375560844, -122.0904289290]]