samplePts: sample _n_ point locations in (or on) a spatial object

View source: R/samplePts.R

samplePtsR Documentation

sample n point locations in (or on) a spatial object

Description

sample location points within a square area, a grid, a polygon, or on a spatial line, using regular or random sampling methods. The function spsample from the package sp is used iteratively to find exactly n sample locations

Usage

samplePts(x, n, type, ...)

Arguments

x

Spatial object; see the sp package for details

n

exact sample size

type

character; "random" for completely spatial random; "regular" for regular (systematically aligned) sampling; "stratified" for stratified random (one single random location in each "cell"); "nonaligned" for nonaligned systematic sampling (nx random y coordinates, ny random x coordinates); "hexagonal" for sampling on a hexagonal lattice; "clustered" for clustered sampling; "Fibonacci" for Fibonacci sampling on the sphere. See the sp package for details

...

other arguments to be passed to spsample

Value

an object of class SpatialPoints-class

See Also

See spsample in the sp package

Examples

data(lalib)
hexPts <- samplePts(lalib, 5, "hexagonal")
plot(lalib, xlim=c(bbox(lalib)[1], bbox(lalib)[3]), ylim=c(bbox(lalib)[2],
    bbox(lalib)[4]))
plot(hexPts, add=TRUE)
## Not run: 
randomPts <- samplePts(lalib, 5, "random")
plot(lalib, xlim=c(bbox(lalib)[1], bbox(lalib)[3]), ylim=c(bbox(lalib)[2],
    bbox(lalib)[4]))
plot(randomPts, add=TRUE)

## End(Not run)

amsantac/geospt documentation built on Feb. 21, 2024, 12:23 p.m.