2

When reading a las file I'm getting the following error:

> readLAS("/tmp/chunk89/u_6300085100_2015.las")
Error: Invalid data: ScanAngle greater than -180 degrees.
In addition: Warning messages:
1: There are 1091 points flagged 'withheld'. 
2: There are 1091 points flagged 'synthetic'. 

Is there anything that can be done to fix this?

3
  • What is the source of the point cloud. TLS?
    – JRR
    Commented Dec 13, 2019 at 1:44
  • No it is ALS, which implies that the scan angle greater than -180 degrees is wrong.
    – Lucas
    Commented Dec 13, 2019 at 4:17
  • 1
    Be careful you may have a corrupted file.
    – JRR
    Commented Dec 13, 2019 at 4:55

1 Answer 1

2

When reading a las file, the content is tested to check if the LAS specifications are respected. You found a case were the verification is a little bit too strict. Scan angle below -180 can be stored up to ±196.608 but are incorrect. You should have a warning instead of an error. This will be improved in rlas. See this issue.

That being said, here some options as workaround

Do not read the scan angle

readLAS("u_6300085100_2015.las", select = "* -a")

While this will solve most of the use cases this won't solve some specific cases such as the use of lasnormalize() with a LAScatalog because all the attributes are loaded. It assumes you do not need the scan angle.

Filter the invalid angles

Just skip the invalid data at read time

readLAS("u_6300085100_2015.las", filter = "-keep_scan_angle -180 180")

This should work with a LAScatalog as well

opt_filter(ctg) <- "-keep_scan_angle -180 180"

It assumes that the bad data correspond only to few weird outliers

Build a LAS object from raw data

You can bypass the use of readLAS(). But this option won't work with a LAScatalog

data <- rlas::read.las("u_6300085100_2015.las")
header <- rlas::read.lasheader("u_6300085100_2015.las")
las <- LAS(data, header, check = FALSE)

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.