LASfile <- system.file("extdata", "example.laz", package="rlas")
las <- readLAS(LASfile, select = "xyz")
print(las)
print(header(las))
x <- 1:30
las <- add_attribute(las, x, "mydata")
print(las) # The las object has a new attribute called "mydata"
print(header(las)) # But the header has not been updated. This new data will not be written
las <- add_lasattribute(las, x, "mydata2", "A new data")
print(las) # The las object has a new attribute called "mydata2"
print(header(las)) # The header has been updated. This new data will be written
# Optionally if the data is already in the LAS object you can update the header skipping the
# parameter x
las <- add_attribute(las, x, "newattr")
las <- add_lasattribute(las, name = "newattr", desc = "Amplitude")
print(header(las))
# Remove an extra bytes attribute
las <- remove_lasattribute(las, "mydata2")
print(las)
print(header(las))
las <- remove_lasattribute(las, "mydata")
print(las)
print(header(las))
Run the code above in your browser using DataLab