Generates a series of points based on an inhomogeneous Poisson process for random point generation.

generatePoints(x, npoints)

Arguments

x

a SpatRaster object representing intensity of the Poisson process.

npoints

An indication of the approximate number of points to be created. As it is based on a stochastic process, it indicates an average number of points to generate for the total area, distributed acordingly to the intensity 'x' but it rarely be exactly the number.

Details

Value

Returns a ppp object with a data frame containing the generated grid coordinates and values generated.

References

Author

Note

See also

Examples

set.seed(1234)

# With default parameters
var <- generateVar(100, 100, 10, 1, 15)
#> [using unconditional Gaussian simulation]

# apply a logitic transformation to values
var$value <- logistic(var$value, 10, 1, 3)

rst <- rast(var, type="xyz")
pnt <- generatePoints(rst, 100000)
pnt
#> Planar point pattern: 99922 points
#> window: rectangle = [0.5, 100.5] x [0.5, 100.5] units

plot(rst)
points(pnt, cex=0.25)