data = data.frame(X = c(339002.889, 339002.983, 339002.918),
Y = c(5248000.515, 5248000.478, 5248000.318),
Z = c(975.589, 974.778, 974.471),
gpstime = c(269347.28141, 269347.28142, 269347.28143),
Intensity = c(82L, 54L, 27L),
ReturnNumber = c(1L, 1L, 2L),
NumberOfReturns = c(1L, 1L, 2L),
ScanDirectionFlag = c(1L, 1L, 1L),
EdgeOfFlightline = c(1L, 0L, 0L),
Classification = c(1L, 1L, 1L),
ScanAngleRank = c(-21L, -21L, -21L),
UserData = c(32L, 32L, 32L),
PointSourceID = c(17L, 17L, 17L))
header = LASheader(data)
header
# Record an EPSG code
epsg(header) <- 32618
header
las <- LAS(data, header)
las
# The function inferred a LAS 1.2 format 1 which is correct
# Upgrade to LAS 1.4 for the example
header@VLR <- list() # Erase VLR previously written
header@PHB[["Global Encoding"]][["WKT"]] <- TRUE
header@PHB[["Version Minor"]] <- 4L
header@PHB[["Header Size"]] <- 375L
header@PHB[["Offset to point data"]] <- 375L
wkt(header) <- sf::st_crs("EPSG:32618")$wkt
header
las1.4 <- LAS(data, header)
las1.4
Run the code above in your browser using DataLab