sss.polygon: Draws a Simple Systematic Sample (SSS) from an area resource...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/sss.polygon.r

Description

Draws a systematic, or grid, sample from a SpatialPolygons or SpatialPolygonsDataFrame object. Optional parameters control control the relative spacing in horizontal and vertical directions, whether a square or triangular grid is produced, and whether the grid baseline has random orientation.

Usage

1
sss.polygon(x, n, spacing = c(1, 1), triangular = FALSE, rand.dir = FALSE)

Arguments

x

A SpatialPolygons or SpatialPolygonsDataFrame object. This object must contain at least 1 polygon. If it contains more than 1 polygon, the SSS sample is drawn from the union of all polygons. Holes are respected.

n

Sample size. Number of locations to draw from the union of all polygons contained in x.

spacing

A vector of length 2 containing the RELATIVE spacing of grid points in the horizontal (X) and vertical (Y) directions. See details.

triangular

Boolean scalar specifying whether to produce a rectangular (triangular==FALSE) or triangular (triangular==TRUE) grid. See Details.

rand.dir

Either a boolean scalar specifying whether to randomly orient the grid's horizontal axis (rand.dir==TRUE) or not (rand.dir==FALSE), or a user-specified fixed direction for the horizontal axis. If FALSE, orientation of the grid is parallel to the X and Y axes. If TRUE, the X axis of the grid is randomly rotated by an angle between -pi/4 (-45 degrees) and pi/4 (45 degrees). If rand.dir is a number, the grid is rotated by that many radians. No range check is performed on user-specified rand.dir, so for example, rotation by pi/8 is equivalent to rotation by pi/8 + 2*pi. User-specified, but random, direction of the grid can be specified by rand.dir = runif(1,0,pi). Note, relative spacing of the grid cells is computed prior to rotation.

Details

The projection system of the input shape object (x) is not considered. But, a projected coordinate system is necessary to obtain correct spacing on the ground. The author STRONGLY recommends converting x to a UTM coordinate system prior to calling this function.

Spacing (size and shape of grid cells) is determined by n and spacing. If spacing is not given, grid spacing is equal in X and Y directions, which produces square grid cells. In this case, grid spacing is delta (= sqrt(A/n), where A = area of union of all polygons in x.

Relative shape of grid cells is controlled by the spacing vector. If spacing = c(rx, ry), spacing in X and Y directions is spacing*delta/rev(spacing), where delta = sqrt(A/n). Conceptually, a square cell of size delta^2 is "stretched" multiplicatively by rx in the X direction and ry in the Y direction. After stretching, the area of each cell remains delta^2 while the relative lengths of the (rectangular) cell sides is 1 to (ry/rx)^2. That is, vertical dimension of each cell is (ry/rx)^2 times the horizontal dimension. Vice versa, the horizontal dimension is (rx/ry)^2 times the vertical.

In general, realized sample size is not fixed. Across multiple calls, realized sample size will not always equal n. Across an infinite number of calls, the average sample size will be n

In all cases, the grid is randomly shifted in the X and Y directions, before rotation (if called for). The amount of the random shift is less than the X and Y extent of cells, and is returned as an attribute of the sample.

Value

A SpatialPointsDataFrame containing locations in the SSS sample, in row-wise order starting in the south (see sampleID, row, col in returned data frame). Attributes of the sample points (in the embedded data frame) are as follows:

Additional attributes of the output object, beyond those which make it a SpatialPointsDataFrame, are:

Author(s)

Trent McDonald

See Also

bas.polygon, sdraw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# A square grid oriented east-west
WA.samp <- sss.polygon( WA, 100 )   
plot( WA )
points( WA.samp )

# A rectangular grid oriented east-west, with relative spacing c(0.667, 1.5),
# or 1 to 2.25.
WA.samp <- sss.polygon( WA, 100, spacing=c(2,3) )   
plot( WA )
points( WA.samp )

# A rectangular grid oriented east-west, with x spacing = 2*(y spacing). 
WA.samp <- sss.polygon( WA, 100, spacing=c(sqrt(2),1) )   

# A rectangular grid, random orientation, with y spacing = 3*(x spacing)
WA.samp <- sss.polygon( WA, 100, spacing=c(1,sqrt(3)), rand.dir=TRUE )   

# A triangular grid oriented east-west
WA.samp <- sss.polygon( WA, 100, triangular=TRUE )   

# A triangular grid oriented east-west, with relative spacing c(.667,1.5)
WA.samp <- sss.polygon( WA, 100, spacing=c(2,3), triangular=TRUE )   

SDraw documentation built on July 8, 2020, 6:23 p.m.