SpaDES (version 1.2.0)

randomPolygons: randomPolygons

Description

Produces a raster of with random polygons. These are built with the spread function internally.

Usage

randomPolygons(ras = raster(extent(0, 15, 0, 15), res = 1), numTypes = 2, ...)

Arguments

ras
A raster that whose extent will be used for the randomPolygons
numTypes
Numeric value. The number of unique polygon types to use. This will be overridden by p, A or minpatch, if any of these are vectors.
...
Other arguments passed to spread. No known uses currently.

Value

A map of extent ext with random polygons.

References

Saura, S. and Martinez-Millan, J. (2000) Landscape patterns simulation with a modified random clusters method. Landscape Ecology, 15, 661--678.

See Also

spread and raster

Examples

Run this code
Ras <- randomPolygons(numTypes = 5)
if (interactive()) Plot(Ras, cols = c("yellow", "dark green", "blue", "dark red"), new = TRUE)

library(raster)
# more complex patterning, with a range of patch sizes
a = randomPolygons(numTypes = 400, raster(extent(0, 50, 0, 50), res = 1))
a[a<320] <- 0
a[a>=320] <- 1
aHist <- hist(table(getValues(clump(a, directions = 4))), plot = FALSE)
if (interactive()) Plot(a, aHist, new = TRUE)

Run the code above in your browser using DataLab