gengrid2: Another function to create a gridified shapefile and extract...

View source: R/gengrid2.R

gengrid2R Documentation

Another function to create a gridified shapefile and extract a raster if specified

Description

This function takes in only a shapefile and creates a square or hexagon polygon grid based on a specified grid size

Usage

gengrid2(
  shp_dt = NULL,
  shp_dsn,
  shp_layer,
  grid_size,
  sqr = TRUE,
  pop_raster,
  raster_path = NULL,
  extract_name,
  raster_function = "sum"
)

Arguments

shp_dt

an object of class 'sf' or 'sfc'

shp_dsn

character; the local directory folder in which the shapefile is location. Must be specified when shp_dt is not specified.

shp_layer

character; the layer name for the shapefile. Must be specified with shp_dsn when shp_dt is not specified

grid_size

numeric of length 1; representing the desired size of the grid in meters

sqr

logical; if TRUE, a square grid is created. If FALSE, a hexagonal polygon grid is created

pop_raster

raster; an object of class 'raster'

raster_path

character; if pop_raster is not specified but raster is to read in from file. raster_path is the full name of the raster (including filepath)

extract_name

character of length 1; the name of the indicator to be extracted from the raster

raster_function

function to be applied in extracting raster into created grids


SSA-Statistical-Team-Projects/SAEplus documentation built on Aug. 24, 2022, 11:26 a.m.