calcBoundaryData: Calculate boundary data for planning units

View source: R/calcBoundaryData.R

calcBoundaryDataR Documentation

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 class 'PolySet'
calcBoundaryData(x, tol = 0.001, length.factor = 1, edge.factor = 1)

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

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

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.

Value

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

See Also

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

Examples

## Not run: 
# simulate planning units
sim_pus <- sim.pus(225L)

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

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

## End(Not run)

paleo13/rapr documentation built on Feb. 12, 2024, 3:27 a.m.