View source: R/getBoundingBox.R
getBoundingBox | R Documentation |
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.
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)
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 |
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°.
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°.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.