Learn R Programming

rLiDAR (version 0.1.1)

chullLiDAR2D: 2D Convex hull of individual tree LiDAR-derived point cloud

Description

Compute and plot the 2D convex hull of individual tree LiDAR-derived point cloud

Usage

chullLiDAR2D(xyid)

Arguments

xyid

A 3-column matrix with the x, y coordinates and points id of the LiDAR point cloud.

Value

Returns A list with components "chullPolygon" and "chullArea", giving the polygon and area of the convex hull.

References

grDevices package,see chull.

Examples

Run this code
# NOT RUN {
# Importing LAS file:
LASfile <- system.file("extdata", "LASexample1.las", package="rLiDAR")

# Reading LAS file
LAS<-readLAS(LASfile,short=TRUE)

# Height subsetting the data
xyz<-subset(LAS[,1:3],LAS[,3] >= 1.37)

# Getting LiDAR clusters
set.seed(1)
clLAS<-kmeans(xyz, 32)

# Set the points id 
id<-as.factor(clLAS$cluster)

# Set the xyid input
xyid<-cbind(xyz[,1:2],id)

# Compute the LiDAR convex hull of the clusters 
chullTrees<-chullLiDAR2D(xyid)

# Plotting the LiDAR convex hull
library(sp)
plot(SpatialPoints(xyid[,1:2]),cex=0.5,col=xyid[,3])
plot(chullTrees$chullPolygon,add=TRUE, border='green')

# Get the ground-projected area of LiDAR convex hull
chullList<-chullTrees$chullArea 
summary(chullList) # summary 
# }

Run the code above in your browser using DataLab