This function returns H3 destination cells for local i, j coordinate pairs anchored by an H3 origin cell.
Arguments
- origin
Character; 15-character cell index generated by H3. A vector of indexes can also be supplied.
- i
a single i coordinate or vector of same, generated by
get_local_ij
- j
a single j coordinate or vector of same, generated by
get_local_ij
- simple
Logical; whether to return a vector of outputs or a data frame containing both inputs and outputs.
Value
If simple = TRUE
, a character vector of destination H3 cells.
If not, a data frame containing columns origin, i, j, destination.
Note
The coordinate space used by this function may have deleted regions or warping due to pentagonal distortion.
Coordinates are only comparable if they come from the same origin cell.
Failure may occur if the destination is too far away from the origin or if the destination is on the other side of a pentagon.
This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.
Examples
# Get local coordinates for a nearby cell
local <- get_local_ij(origin = '86be8d12fffffff', destination = '86be8d127ffffff')
# Convert back to destination cell
get_local_cell(origin = '86be8d12fffffff', i = local[, 1], j = local[, 2])
#> [1] "86be8d127ffffff"