lastpar <- par(mfrow = c(1, 1))
# data
library(sf)
options(sf_use_s2 = FALSE)
ncpath <- system.file("shape/nc.shp", package = "sf")
nc <- read_sf(ncpath)
nc <- st_transform(nc, "EPSG:5070")
# run: nx and ny should strictly be integers
nc_comp_region <-
par_pad_grid(
nc,
mode = "grid",
nx = 4L, ny = 2L,
padding = 10000)
par(mfcol = c(1, 2))
plot(nc_comp_region$original$geometry)
plot(nc_comp_region$padded$geometry)
nc_comp_region_wkt <-
par_pad_grid(
nc,
mode = "grid",
nx = 4L, ny = 2L,
padding = 10000,
return_wkt = TRUE)
nc_comp_region_wkt$original
nc_comp_region_wkt$padded
par(lastpar)
Run the code above in your browser using DataLab