getBoundingBox: Rotated and scaled bounding box

View source: R/getBoundingBox.R

getBoundingBoxR Documentation

Rotated and scaled bounding box

Description

This function creates a bounding box for every SpatialPolygonsDataFrame object. Moreover, the bounding box is rotated and scaled in a direction given by the user.

Usage

getBoundingBox(spdf, col.name, scale.factor = 2, k = 2,
  projection = NA, centroid = FALSE, set.centroid = "inverse",
  k.centroid = 2, scale.side = "long", cores = 1, quiet = TRUE)

Arguments

spdf

SpatialPolygonsDataFrame. SPDF must contains a valid ID field and a field containing direction angles

col.name

name or number of column containing angles in degree

scale.factor

scale factor for bounding box. This can also be vector with two elements: 1. for first side (default: small), and 2. second side (default: longside). Default: 2

k

factor controlling the distance between first two coordinates related to the side and centroid. Default: 2

projection

projection of spdf in CRS-format. If spdf is projected, projection is read from spdf. Default: NA

centroid

centroid is taken for the bounding box. Default: FALSE

set.centroid

set intial starting point of bounding box with respect to the centroid. Default: "inverse" (alternative: "direction")

scale.side

side which is scaled in direction. Default: "long" (alternative: small)

cores

number of cores for parallel processing. Default: 1 (sequential)

quiet

show output on console. Default: FALSE

k.centroid.flow

same as k, used when centroid is set to FALSE

Details

The calculation is performed by trigonometric functions.
R takes angles in the following anti-clockwise sense:
EAST 0°, NORTH 90°, WEST 180°, SOUTH 270°.

However, the angles in the output have the following clockwise sense:
NORTH 0°, EAST 90°, SOUTH 180°, WEST 270°.

Note

  • SpatialPolygonsDataFrame must have a valid ID field and a column specifying the angles in which the bounding box is rotated

  • Angles will be transformed to clockwise sense: NORTH 0°, EAST 90°, SOUTH 180°, WEST 270°.


raff-k/Lslide documentation built on March 29, 2022, 6:52 p.m.