srs.polygon: Draws a Simple Random Sample (SRS) from an area resource...

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

View source: R/srs.polygon.r

Description

Draws a simple random sample from a SpatialPolygons or SpatialPolygonsDataFrame object.

Usage

1

Arguments

x

A SpatialPolygons or SpatialPolygonsDataFrame object. This object must contain at least 1 polygon. If it contains more than 1 polygon, the SRS 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.

Details

The SRS sample is drawn by generating uniform random deviates for coordinates in the bounding box surrounding polygons (e.g., c(xmin, ymin) + c(dx,dy)*runif(2)), tossing locations outside polygons until the required number is achieved.

Value

A SpatialPointsDataFrame containing locations in the SRS sample, in arbitrary order. 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, sss.polygon, hip.polygon, sdraw

Examples

1
2
3
4
# A square grid oriented east-west
WA.samp <- srs.polygon( WA, 100 )   
plot( WA )
points( WA.samp, pch=16 )

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