# NOT RUN {
LASfile <- system.file("extdata", "example.laz", package="rlas")
las = readLAS(LASfile)
# Manual modification of the coordinates (e.g. rotation, re-alignment, ...)
las@data$X <- las@data$X + 2/3
las@data$Y <- las@data$Y - 5/3
# The point cloud is no longer valid
las_check(las)
# It is important to fix that
las_quantize(las)
# Now the file is almost valid
las_check(las)
# Update the object to set up-to-date header data
las <- las_update(las)
las_check(las)
# In practice the above code is not useful for regular users because the operators
# $<- already perform such operations on-the-fly. Thus the following
# syntax must be preferred and returns valid objects. Previous tools
# were only intended to be used in very specific cases.
las$X <- las$X + 2/3
las$Y <- las$Y - 5/3
# Rescale and reoffset recompute the coordinates with
# new scales and offsets according to LAS specification
las <- las_rescale(las, xscale = 0.01, yscale = 0.01)
las <- las_reoffset(las, xoffset = 300000, yoffset = 5248000)
# }
Run the code above in your browser using DataLab