Get H3 cell index within a polygon
This function returns all the H3 cell index within the supplied polygon geometry.
polyfill(geometry = NULL, res = NULL, simple = TRUE)
geometry |
‘sf' object of type ’POLYGON' or 'MULTIPOLYGON'. |
res |
Integer; Desired H3 resolution. See https://h3geo.org/docs/core-library/restable/ for allowable values and related dimensions. |
simple |
Logical; whether to return a vector of outputs or an sf object containing both inputs and outputs. |
By default, a list of length(h3_address). Each list element contains a character vector of H3 cell indices belonging to that geometry. A result of NA indicates that no H3 cell indices of the chosen resolution are centered over the geometry.
This function will be slow with a large number of polygons, and/or polygons that are large relative to the hexagon area at the chosen resolution. A message is printed to console where the total input area is (roughly) > 100000x the area of the chosen H3 resolution.
# Which level 5 H3 cell indices have centers inside County Ashe, NC? nc <- sf::st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE) nc1 <- nc[1, ] fillers <- polyfill(geometry = nc1, res = 5)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.