Description Usage Arguments Value Examples
Get all hexagons with centers contained in a given polygon
1 2 3 4 5 6 7 8 9 10 11 12 13 | polyfill(coords, res = 7, is_geojson = TRUE)
## S3 method for class 'matrix'
polyfill(coords, res = 7, is_geojson = TRUE)
## S3 method for class 'data.frame'
polyfill(coords, res = 7, is_geojson = TRUE)
## S3 method for class 'list'
polyfill(coords, res = 7, is_geojson = TRUE)
## S3 method for class 'sf'
polyfill(coords, res = 7, is_geojson = TRUE)
|
coords |
numeric vector, matrix or data.frame with [lat, lng]
or [lng, lat] pairs if |
res |
resolution; number between 0 and 15 |
is_geojson |
boolean; expect [lng, lat] pairs instead of [lat, lng]? |
h3 indexes; character vector or list of character vectors if multiple polygons are supplied
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | library(sf)
list(greater_manchester) %>%
st_polygon() %>%
st_sfc(crs = 4326) %>%
plot()
polyfill(greater_manchester, 6) %>%
h3_to_geo_boundary() %>%
geo_boundary_to_sf() %>%
plot(add = TRUE)
nc <- system.file("shape/nc.shp", package = "sf") %>%
st_read(quiet = TRUE)
st_geometry(nc) %>%
plot(border = "red")
polyfill(nc, 5) %>% unlist() %>%
h3_to_geo_boundary() %>%
geo_boundary_to_sf() %>%
plot(add = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.