Open jstrunk001 opened 5 years ago
The error is reproducible without lidR
. Moving the issue to rlas
data1 = read.las("~/Téléchargements/SubArea_012_011.8_6.las")
header1 = read.lasheader("~/Téléchargements/SubArea_012_011.8_6.las")
f = tempfile(fileext = ".las")
write.las(f, header1, data1)
data2 = read.las(f)
#> ERROR: 'end-of-file' after 6359 of 6365 points
#> Warning: there are 19 points flagged 'withheld'.
#> Warning: there are 3658 points flagged 'synthetic'.
header2 = read.lasheader(f)
Well, I found the issue. But in the meantime I don't know how to fix it and I'm not even sure if I should fix it. Basically the header states to add an offset in the binary file but this offset is not respected. I'm not going through details. The following fixes your issues waiting for a better internal fix.
library(lidR)
las = readLAS("SubArea_012_011.8_6.las")
las@header@PHB$`Header Size` = 235
f = tempfile(fileext = ".las")
writeLAS(las, f)
I'm wondering if @floriandeboissieu have a better understanding of the header size management in LASlib
Ok, thank you JR!
Sorry for the late answer, I don't have much time this end of year. I'll dig into it as soon as I can.
Hello, I have a specific set of laz files that result in strange behavior when read / write with lidR
SubArea_012_011.8_6.las.zip