3

While looping through my list of LAS files in a directory (I'm using readLAS to record warnings and errors for each file), at least one file gives an error message in the console window (i.e. ERROR: 'end-of-file' after 3355392 of 25918554 points). The error doesn't interrupt the loop but that file will be invalid. Is it possible to catch this in the code on the fly while reading the LAS file? Or does it have to be done after the loop finishes by reviewing message outputs in the console?

1 Answer 1

3

Your file is corrupted. The error is thrown from the LASlib library and is not strictly an error programmatically speaking. This is why no error or warning is thrown at the R level. It is printed in the standard R output so I guess the message can be captured with capture.output(). But anyway you should fix your file with e.g. las2las from LAStools.

2
  • thanks I'll go with the 'capture.output()'. Note, I tried the las2las tool from LAStools; but, while it allowed for further processing, it had truncated the data at the end-of-file part of the file. (this file I found out will be redelivered anyway).
    – Ray J
    Mar 6, 2020 at 20:27
  • If las2las truncates the file then lidR will likely truncate the file as well
    – JRR
    Mar 6, 2020 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.