Learn R Programming

raptr (version 0.0.3)

calcBoundaryData: Calculate boundary data for planning units

Description

This function calculates boundary length data for PolySet, SpatialPolygons, and SpatialPolygonsDataFrame objects. Be aware that this function is designed to be as fast as possible, 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. If argument set to SpatialPolygons or SpatialPolygonsDataFrame, this will be converted to PolySet before processing.

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)

Arguments

x

PolySet, SpatialPolygons or SpatialPolyognsDataFrame object.

tol

numeric to specify precision of calculations (that is, how far apart do 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.

...

not used.

Value

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

Run this code
# NOT RUN {
# simulate planning units
sim_pus <- sim.pus(225L)
# calculate boundary data
bound.dat <- calcBoundaryData(sim_pus)
summary(bound.dat)
# }

Run the code above in your browser using DataLab