Learn R Programming

geospt (version 0.4-9)

samplePts: 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

Value

an object of class SpatialPoints-class

See Also

See spsample in the sp package

Examples

Run this code
data(lalib)

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)

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)

Run the code above in your browser using DataLab