stemMappingExtension: Extend stem mapping to a target area and shape.

Description Usage Arguments Value Author(s) Examples

View source: R/stemMappingExtension.R

Description

The function cuts a circle stem map into a largest hexagon in circle and extends this hexagon to a target area and shape. This is a generic function.

Usage

1
2
stemMappingExtension(objectID, azimuth, distance, radius = 11.28,
  targetArea = 1, targetShape = "square", randomRotate = FALSE)

Arguments

objectID

character, A object's ID, e.g., a tree's ID.

azimuth

numeric, Azimuth of a object from the north. It should be between 0 to 360.

distance

numeric, Distance between a object and the centre of the circle.

radius

numeric, Radius of the circle. If missing, 11.28 will be used, as it presents the radius of a circle for big trees (i.e., trees DBH >= 9).

targetArea

numeric, Defines the area you may want to extend. The unit of this input is ha. Default is 1 ha.

targetShape

character, Defines the shape of the target area. It currently supports circle and square. The default is square.

randomRotate

logical, Defines whether need to random rotate the hexagon when merge into a targetArea. The default is FALSE.

Value

A table contains the x and y for all the objects in the extended area.

Author(s)

Yong Luo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## Not run: 
## randomly generate some trees
library(data.table)
smallplottrees <- data.table(tree_id = 1:20,
                             angle = runif(20, min = 0, max = 360),
                             distance = runif(20, min = 0, max = 5.6))
## extend it to 1 ha
treelist_smallplot <- stemMappingExtension(objectID = smallplottrees$tree_id,
                                           azimuth = smallplottrees$angle,
                                           distance = smallplottrees$distance,
                                           radius = 5.64,
                                           randomRotate = TRUE)


bigplottrees <- data.table(tree_id = 1:20,
                           angle = runif(20, min = 0, max = 360),
                           distance = runif(20, min = 0, max = 11.28))
## extend it to 1 ha
treelist_bigplot <- stemMappingExtension(objectID = bigplottrees$tree_id,
                                         azimuth = bigplottrees$angle,
                                         distance = bigplottrees$distance,
                                         radius = 11.28)
treelist_smallplot[, source := "smallplot"]
treelist_bigplot[, source := "bigplot"]


alltreelist <- rbind(treelist_bigplot, treelist_smallplot)


alltreeplot <- ggplot(data = alltreelist, aes(x, y))+
 geom_point(aes(col = factor(source)))


## End(Not run)

bcgov/BCForestGroundSample documentation built on May 25, 2019, 3:21 p.m.