Learn R Programming

lidR (version 1.2.1)

lasclip: Clip LiDAR points

Description

Clip LiDAR points within a given geometry and convenient wrappers most common geometries

Usage

lasclip(.las, geometry, coord, inside = TRUE)

lasclipRectangle(.las, xleft, ybottom, xright, ytop, inside = TRUE)

lasclipPolygon(.las, x, y, inside = TRUE)

lasclipCircle(.las, xcenter, ycenter, radius, inside = TRUE)

Arguments

.las

An object of class LAS

geometry

charaters. name of a geometry. Can be "circle", "rectangle", "polygon", "cuboid" or "sphere"

coord

matrix or data.frame. The coordinates of the minimum points required to fully describe the geometry. For circle a 1-by-3 matrix, for rectangle a 2-by-2 matrix, for polygon n-by-2 matrix, for cuboid 2-by-3 matrix and for sphere a 1-by-4 matrix

inside

logical. Keep data inside or outside the shape

xleft

scalar. of left x position.

ybottom

scalar. of bottom y position.

xright

scalar. of right x position.

ytop

scalar. of top y position.

x

numerical array. x-coordinates of polygon

y

numerical array. y-coordinates of polygon

xcenter

scalar. x disc center

ycenter

scalar. y disc center

radius

scalar. Disc radius

Value

An object of class LAS

Examples

Run this code
# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)

subset = lidar %>% lasclipRectangle(xleft  = 684850, ybottom = 5017850,
                                    xright = 684900, ytop    = 5017900)
plot(subset)

msphere = matrix(c(684850, 5017850, 10, 10), ncol = 4)
subset = lidar %>% lasclip("sphere", msphere)
plot(subset)

mrect = matrix(c(684850, 684900, 5017850, 5017900), ncol = 2)
subset = lidar %>% lasclip("rectangle", mrect)
# }

Run the code above in your browser using DataLab