par_make_dggrid: Convert DGGRID indices to sf object

View source: R/gridding.R

par_make_dggridR Documentation

Convert DGGRID indices to sf object

Description

This function converts DGGRID indices to an sf object. It requires the dggridR package to be installed.

Usage

par_make_dggrid(x, res = 8L, topology = "HEXAGON")

Arguments

x

sf object.

res

integer(1). DGGRID resolution. Default is 8L.

topology

character(1). Topology type, either "HEXAGON" or "SQUARE". Default is "HEXAGON".

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.

Value

An sf object with polygons representing the DGGRID indices.

Author(s)

Insang Song

See Also

Other Parallelization: par_cut_coords(), par_grid(), par_grid_mirai(), par_hierarchy(), par_hierarchy_mirai(), par_make_grid(), par_make_h3(), par_merge_grid(), par_multirasters(), par_multirasters_mirai(), par_pad_balanced(), par_pad_grid(), par_split_list()

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))
}
par(lastpar)

chopin documentation built on Sept. 10, 2025, 5:08 p.m.