xscale, yscale, zscale: scalar. Can be missing if not relevant.
xoffset, yoffset, zoffset: scalar. Can be missing if not relevant.
by_reference: bool. Update the data in place without allocating new memory.
x: numeric. Coordinates vector
scale, offset: scalar. scale and offset
...: Unused.
Details
In the specification of the LAS format the coordinates are expected to be given with a certain precision e.g. 0.01 for a millimeter precision (or millifeet), meaning that a file records e.g. 123.46 not 123.45678. Also, coordinates are stored as integers. This is made possible with a scale and offset factor. For example, 123.46 with an offset of 100 and a scale factor of 0.01 is actually stored as (123.46 - 100)/0.01 = 2346. Storing 123.45678 with a scale factor of 0.01 and an offset of 100 is invalid because it does not convert to an integer: (123.45678-100)/0.01 = 2345.678. Having an invalid LAS object may be critical in some lidR applications. When writing into a LAS file, users will loose the extra precision without warning and some algorithms in lidR use the integer conversion to make integer-based computation and thus speed-up some algorithms and use less memory. Creation of an invalid LAS object may cause problems and incorrect outputs.
Examples
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/3las@data$Y <- las@data$Y -5/3# The point cloud is no longer validlas_check(las)# It is important to fix thatlas_quantize(las)# Now the file is almost validlas_check(las)# Update the object to set up-to-date header datalas <- 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/3las$Y <- las$Y -5/3# Rescale and reoffset recompute the coordinates with# new scales and offsets according to LAS specificationlas <- las_rescale(las, xscale =0.01, yscale =0.01)las <- las_reoffset(las, xoffset =300000, yoffset =5248000)