Function to create sampling grids as per CSAS or S3M specifications. This is a wrapper function for spsample() function in sp package that adds arguments needed to implement CSAS and S3M-specific sampling.

create_sp_grid(
  x,
  d = NULL,
  area = NULL,
  country = NULL,
  buffer = ifelse(!is.null(d), d, 0),
  n = NULL,
  n.factor = NULL,
  type = "s3m",
  fixed = FALSE
)

Arguments

x

Spatial object to grid

d

A numeric value for distance (in kilometres) of the maximum distance of a village/community from a sampling point. Default is 10 kilometres.

area

A numeric value for area (in square kilometres) of a hexagon in a hexagonal grid defining the sampling spatial resolution

country

Name of country where sampling area is located. This is used to determine the appropriate UTM projection to transform x

buffer

A numeric value for distance (in kilometres) to expand the borders of the given spatial object x. Specifying buffer corrects the behaviour of spsample() to limit selection of sampling points well within the borders of x often leaving areas at or near the border of x unsampled. Default is d (if specified) otherwise defaults to 0 (no buffer).

n

Approximate number of sampling points / clusters needed. Approximate because spsample() does not always result in n grids. If n is the minimum number of sampling points required, specify n.factor to inflate n with to ensure required minimum. If fixed n amount of sampling points needed, specify fixed to TRUE and specify n.factor to inflate n.

n.factor

Inflation factor for n. Default value is 0 (no inflation) which produces approximate number of grids (i.e., more or less n). If minimum number of sampling points required, specify n.factor to increase n with to ensure that number of grids will be at least n. If fixed number of sampling points required (i.e., exactly n), specify n.factor to increase n with. Function will go through repeat cycles of spsample() until n sampling points are selected.

type

A character value of either "csas" or "s3m" to specify type of spatial sampling to perform. If "csas", a systematically aligned sampling is applied by passing the argument type "regular" to spsample. If "s3m", sampling on a hexagonal lattice is applied by passing the argument type "hexagonal" to spsample. Default is "s3m".

fixed

Logical. If TRUE, n.factor must be specified and function will go through repeat cycles of spsample() until n sampling points are selected. Default is FALSE.

Value

An object of SpatialPoints-class. The number of points is only guaranteed to equal n when sampling is done in a square box, i.e. (sample.Spatial). Otherwise, the obtained number of points will have expected value n.

Examples

#