LAS-class {lidR} | R Documentation |
An S4 class to represent a .las or .laz file
Description
Class LAS is the representation of a las/laz file according to the LAS file format specifications.
Usage
LAS(data, header = list(), crs = sf::NA_crs_, check = TRUE, index = NULL, ...)
Arguments
data |
a data.table containing the data of a las or laz file. |
header |
a |
crs |
crs object of class crs from sf |
check |
logical. Conformity tests while building the object. |
index |
list with two elements |
... |
internal use |
Details
A LAS
object contains a data.table
with the data read from a las/laz
file and
a LASheader (see the ASPRS documentation for the
LAS file format
for more information). Because las files are standardized the table of attributes read from the las/laz file
is also standardized. Columns are named:
X
,Y
,Z
(numeric)gpstime
(numeric)Intensity
(integer)ReturnNumber
,NumberOfReturns
(integer)ScanDirectionFlag
(integer)EdgeOfFlightline
(integer)Classification
(integer)Synthetic_flag
,Keypoint_flag
,Withheld_flag
(logical)ScanAngleRank
/ScanAngle
(integer/numeric)UserData
(integer)PointSourceID
(integer)R
,G
,B
,NIR
(integer)
Value
An object of class LAS
Functions
-
LAS()
: creates objects of class LAS. The original data is updated by reference to quantize the coordinates according to the scale factor of the header if no header is provided. In this case the scale factor is set to 0.001
Slots
crs
Object of class crs from sf.
data
Object of class data.table. Point cloud data according to the LAS file format
header
Object of class LASheader. LAS file header according to the LAS file format
index
list. See spatial indexing.
See Also
Examples
# Read a las/laz file
LASfile <- system.file("extdata", "example.laz", package="rlas")
las <- readLAS(LASfile)
las
# Creation of a LAS object out of external data
data <- data.frame(X = runif(100, 0, 100),
Y = runif(100, 0, 100),
Z = runif(100, 0, 20))
# 'data' has many decimal digits
data
# Create a default header and quantize *by reference*
# the coordinates to fit with offset and scale factors
cloud <- LAS(data)
# 'data' has been updated and coordinates were quantized
data
cloud
# Be careful when providing a header the function assumes that
# it corresponds to the data and won't quantize the coordinates
data <- data.frame(X = runif(100, 0, 100),
Y = runif(100, 0, 100),
Z = runif(100, 0, 20))
header <- header(las)
# This works but triggers warnings and creates an invalid LAS object
cloud <- LAS(data, header)
las_check(cloud)