GapSPDF: Forest Canopy Gaps as Spatial Polygons

Description Usage Arguments Value Author(s) Examples

View source: R/GapsSPDF.R View source: R/GapSPDF.R

Description

This function converts forest canopy gaps as RasterLayer (raster) to SpatialPointsDataFrame-class objects

Usage

1
GapSPDF(gap_layer)

Arguments

gap_layer

ALS-derived gap layer (output of getForestGaps function). An object of the classs RasterLayer.

Value

A SpatialPointsDataFrame-class object of the forest canopy gaps. The output file can be exported as a ESRI shapefile using writeOGR function in the rgdal package.

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
## Not run: 
#Loading raster and viridis libraries
library(raster)
library(viridis)

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

# 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)

# Converting raster layer to SpatialPolygonsDataFrame
gaps_spdf<-GapSPDF(gap_layer=gaps_duc)

# Plotting ALS-derived CHM and forest gaps
plot(ALS_CHM_DUC, col=viridis(10), xlim=c(173025,173125), ylim=c(9673100,96731200))
plot(gaps_spdf, add=TRUE, border="red", lwd=2)

# Populating the attribute table of Gaps_spdf with gaps statistics
gaps_stats<-GapStats(gap_layer=gaps_duc, chm_layer=ALS_CHM_DUC)
gaps_spdf<-merge(gaps_spdf,gaps_stats, by="gap_id")
head(gaps_spdf@data)

## End(Not run)

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