Get the boundary of an H3 cell index
This function takes an H3 cell index and returns its bounding shape (usually a hexagon) in WGS84.
h3_to_polygon(input = NULL, simple = TRUE)
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 'sfc_POLYGON' object or an 'sf' data frame containing both inputs and outputs. |
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.
# What is the hexagon over the Brisbane Town Hall at resolution 10? brisbane_hex_10 <- h3_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_h3(bth, res = seq(10, 15)), use.names = FALSE) bth_hexes <- h3_to_polygon(input = bth_addys) plot(bth_hexes, axes = TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.