Learn R Programming

raptr (version 1.0.1)

calcBoundaryData: Calculate boundary data for planning units

Description

This function calculates boundary length data. Be aware that this function is designed with performance in mind, and as a consequence, if this function is used improperly then it may crash R. Furthermore, multipart polygons with touching edges will likely result in inaccuracies.

Usage

calcBoundaryData(x, tol, length.factor, edge.factor)

# S3 method for PolySet calcBoundaryData(x, tol = 0.001, length.factor = 1, edge.factor = 1)

# S3 method for SpatialPolygons calcBoundaryData(x, tol = 0.001, length.factor = 1, edge.factor = 1)

# S3 method for sf calcBoundaryData(x, tol = 0.001, length.factor = 1, edge.factor = 1)

Value

A data.frame with 'id1' (integer), 'id2' (integer), and 'amount' (numeric) columns.

Arguments

x

sf::st_sf() or PBSMapping::PolySet object.

tol

numeric to specify precision of calculations. In other words, how far apart vertices have to be to be considered different?

length.factor

numeric to scale boundary lengths.

edge.factor

numeric to scale boundary lengths for edges that do not have any neighbors, such as those that occur along the margins.

See Also

This function is based on the algorithm in QMARXAN https://github.com/tsw-apropos/qmarxan for calculating boundary length.

Examples

Run this code
if (FALSE) {
# simulate planning units
sim_pus <- sim.pus(225L)

# calculate boundary data
bound.dat <- calcBoundaryData(sim_pus)

# print summary of boundary data
summary(bound.dat)
}

Run the code above in your browser using DataLab