getForestGaps: Forest Canopy Gap Detection

Description Usage Arguments Value Author(s) Examples

View source: R/getForestGaps.R

Description

This function detects forest canopy gaps on Airborne Laser Scanning(ALS)-derived Canopy Height Model (CHM).

Usage

1
getForestGaps(chm_layer, threshold=10, size=c(1,10^4))

Arguments

chm_layer

ALS-derived Canopy Height Model (CHM) RasterLayer (raster) object. An object of the classs RasterLayer.

threshold

Height threshold for gap detection. Default is 10 m.

size

A vector containing the minimum and maximum gap size - area (m2). Gaps with area < size[1] or area > size[2] are not considered. Default is 1 m2 and 1ha.

Value

Forest Gaps. An object of the classs RasterLayer.

Author(s)

Carlos Alberto Silva.

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#=======================================================================#
# Importing ALS-derived Canopy Height Model (CHM)
#=======================================================================#
#Loading raster and viridis libraries
library(raster)
library(viridis)

# ALS-derived CHM over Adolpho Ducke Forest Reserve - Brazilian tropical forest
data(ALS_CHM_DUC)

# Plotting chm
plot(ALS_CHM_DUC, col=viridis(10), main= "ALS CHM")
grid()
#=======================================================================#
# Example 1: Forest Gap detection using a fixed canopy height thresholds
#=======================================================================#

# set height thresholds (e.g. 10 meters)
threshold<-10
size<-c(1,10^4) # m2

# Detecting forest gaps
gaps_duc<-getForestGaps(chm_layer=ALS_CHM_DUC, threshold=threshold, size=size)

# Ploting gaps
plot(gaps_duc, col="red", add=TRUE, main="Forest Canopy Gap", legend=FALSE)

#=======================================================================#
# Example 2: Gap detection using multiple canopy height thresholds
#=======================================================================#

# set the height thresholds
nthresholds<-c(10,15,20,25)
size<-c(1,10^4) # m2

# creating an empy raster stack to store multplie gaps as RasterLayers
gaps_stack<-stack()

# Gap detection
for (i in nthresholds){
 gaps_i<-getForestGaps(chm_layer=ALS_CHM_DUC, threshold=i, size=size)
 names(gaps_i)<-paste0("gaps_",i,"m")
 gaps_stack<-stack(gaps_stack,gaps_i)
}

# plot gaps
par(mfrow=c(2,2))
plot(ALS_CHM_DUC, col=viridis(10), main="Height threshold 10m")
plot(gaps_stack$gaps_10m, col="red",add=TRUE, legend=FALSE)

plot(ALS_CHM_DUC, col=viridis(10), main="Height threshold 15m")
plot(gaps_stack$gaps_15m, col="red",add=TRUE, legend=FALSE)

plot(ALS_CHM_DUC, col=viridis(10), main="Height threshold 20m")
plot(gaps_stack$gaps_20m, col="red",add=TRUE, legend=FALSE)

plot(ALS_CHM_DUC, col=viridis(10), main="Height threshold 25m")
plot(gaps_stack$gaps_25m, col="red",add=TRUE, legend=FALSE)

ForestGapR documentation built on May 2, 2019, 1:26 a.m.