This function converts DGGRID indices to an sf object.
It requires the dggridR package to be installed.
Details
dggridR::dgconstruct is used to create a
DGGRID object with the specified resolution. All arguments in
this function are used as default values other than
res and topology.
Examples
lastpar <- par(mfrow = c(1, 1))
library(sf)
if (rlang::is_installed("dggridR")) {
library(dggridR)
options(sf_use_s2 = FALSE)
ncpath <- system.file("shape/nc.shp", package = "sf")
nc <- read_sf(ncpath)
nc <- st_transform(nc, "EPSG:4326")
nc_comp_region_dggrid <-
par_make_dggrid(
nc,
res = 8L,
topology = "HEXAGON"
)
plot(sf::st_geometry(nc_comp_region_dggrid))
}
#> Input sf object should be in WGS84 (EPSG:4326) CRS.
par(lastpar)