mosaic: Generate a random mosaic

mosaicR Documentation

Generate a random mosaic

Description

mosaic generates polygon units within a sample frame using a stochastic tessellation algorithm. The desired number of units can be specified as an exact density or an average unit area.

Usage

mosaic(frame, density = NULL, area = NULL, method = voronoi)

Arguments

frame

An sf object, or an object which can be converted to sf, containing the sample frame as a spatial polygon

density

An integer specifying the desired number of units to be generated within the sample frame. Not required if area is set.

area

An integer or double specifying the desired average area of each unit. The units are assumed to match those given by sf::st_area() for frame. Not required if density is set.

method

The tessellation model to be used to generate the mosaic; see details.

Details

method accepts a function describing the tessalation model to be used (see \insertCiteVan_Lieshout2012-hbfieldwalkr for an overview). Currently the only method implemented in the package is voronoi(), which generates a Voronoi tessellation using a set of uniformly distributed random points and Delaunay triangulation.

Value

An sf object containing the units as polygons with an integer id.

References

\insertRef

Van_Lieshout2012-hbfieldwalkr

Examples

frame <- rpolygon()

# Fixed number of units using Voronoi tesselation
units <- mosaic(frame, density = 50, method = voronoi)
plot(units)

# Average unit area
units <- mosaic(frame, area = 20000, method = voronoi)
plot(units)


joeroe/fieldwalkr documentation built on Feb. 17, 2024, 12:15 a.m.