make_2d_grid: Make a raster, point, or polygon grid from an sf polygon

View source: R/make_2d_grid.R

make_2d_gridR Documentation

Make a raster, point, or polygon grid from an sf polygon

Description

Creates a raster (terra 'SpatRaster'), point grid (sf 'POINT'), or polygon mesh/'fishnet' (sf 'POLYGON') from an sf polygon.

Usage

make_2d_grid(
  obj,
  resolution = c(3704, 3704),
  output_type = "point",
  bbox = NULL,
  model = "semi-open",
  include_tile_center = FALSE
)

Arguments

obj

An sf polygon.

resolution

Resolution for grid cells. Default = c(3704, 3704), equivalent of 2x2 nautical miles.

output_type

Type of output as a 1L character vector ("point", "raster", "polygon).

bbox

Optional. A 4L numeric vector to define the edges of the interpolation grid c(xmin, ymin, xmax, ymax).

model

Character vector indicating the geometry model to use for st_intersection boundaries. Default = "semi-open"; for details see ?s2::s2_options

include_tile_center

Should the center point of each tile be included in the output? This helps with plotting data because the center point for grid locations after interecting with the stratum shapefile is not always the center of a grid cell since intersected cells are not always squares.


afsc-gap-products/akgfmaps documentation built on April 14, 2025, 7:13 p.m.