Learn R Programming

h3jsr (version 1.3.1)

get_local_cell: Get H3 cell from local i, j coordinates

Description

This function returns H3 destination cells for local i, j coordinate pairs anchored by an H3 origin cell.

Usage

get_local_cell(origin = NULL, i = NULL, j = NULL, simple = TRUE)

Value

If simple = TRUE, a character vector of destination H3 cells. If not, a data frame containing columns origin, i, j, destination.

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.

Examples

Run this code
# 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])

Run the code above in your browser using DataLab