# 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)
Run the code above in your browser using DataLab