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

Description Usage Arguments Value See Also Examples

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)

geospt documentation built on May 2, 2019, 4:51 p.m.