r-lidar / rlas

R package to read and write las and laz files used to store LiDAR data
https://cran.r-project.org/package=rlas
GNU General Public License v3.0
34 stars 14 forks source link

Classification attribute lost when writing LAS 1.4 prf 6 #36

Closed Jean-Romain closed 5 years ago

Jean-Romain commented 5 years ago
library(rlas)

w = tempfile(fileext = ".las")
r = "~/Documents/ALS data/Fichiers las divers/las14_prf6.las"
lasw = read.las(r)
header = read.lasheader(r)
write.las(w, header, lasw)
lasr = read.las(w)

all.equal(lasw, lasr)
#> [1] "Column 'Classification': Mean relative difference: 1"
head(lasw$Classification)
#> [1] 1 1 1 1 1 1
head(lasr$Classification)
#> [1] 0 0 0 0 0 0

Created on 2019-04-16 by the reprex package (v0.2.1)

Jean-Romain commented 5 years ago

ScanAngle is also wrong and yet all.equal did not notice that

head(lasw$ScanAngle)
#> [1] 2.718 2.736 2.754 2.778 2.796 2.820
head(lasr$ScanAngle)
#> [1] 1.998 1.998 1.998 1.998 1.998 1.998
Jean-Romain commented 5 years ago

Fixed by updating LASlib. The issue with ScanAngle was my bad.