cell_to_polygon {h3jsr} | R Documentation |
Get the boundary of an H3 cell index
Description
This function takes an H3 cell index and returns its bounding shape (usually a hexagon) in WGS84.
Usage
cell_to_polygon(input = NULL, simple = TRUE)
Arguments
input |
Character; 15-character index generated by H3, or a vector or list of same, or a data frame where the first column contains H3 addresses. |
simple |
Logical; whether to return an |
Value
By default, an sfc_POLYGON
object of length(input)
. If an
appropriately formatted data frame is supplied, an sf
data frame
containing input attributes and geometry.
Examples
# What is the hexagon over the Brisbane Town Hall at resolution 10?
brisbane_hex_10 <- cell_to_polygon(input = '8abe8d12acaffff')
# Give me some of the cells over Brisbane Town Hall as an sf object
bth <- sf::st_sfc(sf::st_point(c(153.023503, -27.468920)), crs = 4326)
bth_addys <- unlist(point_to_cell(bth, res = seq(10, 15)), use.names = FALSE)
bth_hexes <- cell_to_polygon(input = bth_addys)
plot(bth_hexes, axes = TRUE)
[Package h3jsr version 1.3.1 Index]