-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read.las segfault with "-keep_class" when greater than 31 #26
Comments
We must consider two things here. One comes from you, the other one comes from LASlib or Firstly, a classification above 31 does not exist. The classification attribute is stored on 5 bits and thus the maximum classification value is 2⁵-1 = 31 (see ASPRS LAS specification). What is the expected behavior of That being said it did not return 0 point or throw an error. The behavior was a segfault. This is not a bug in Let test what happens with
It means either that:
Anyway this is a bug with the package |
After reading the source code the good answer is: rlas does not catch this error. Bug confirmed. Thank you for reporting. |
Thanks Jean-Romain for getting back so quickly! I’m new to R and new to reporting on message boards so I hope my message made sense. Happy New Year
|
Bug fixed. Now fails with an error: library(rlas)
lazfile <- system.file("extdata", "example.laz", package="rlas")
lasdata <- read.las(lazfile, filter = "-keep_class 333")
#> ERROR: cannot keep classification 333 because it is larger than 31
#> Error in C_reader(ifiles, ofile, select, filter, filter_wkt) :
#> Filter error see message above. |
Are you using LAS 1.4 file format with point format 6? In that case class 186 exist. |
Yes – you are correct, that appears to be directly related as to why I ran into problems. This is a bit of a learning process for me although I’ve worked several times with LAS point cloud files I never clued into the limits on the classification codes. Although R is a bit of a steep learning curve for me (I’m a SAS guy), I thoroughly enjoy using the tools you have developed. They are lightning fast - especially compared to working with the point cloud in ARCGIS. Thanks again!
|
That makes me happy. I'm working hard on speed improvement. I'm glad to know that I beat ARCGIS 😉 |
If you are working with LAS 1.4 and format > 6, digging int the source code of LAS lib I found rlas::read.las("las14_prf6.las", filter = "-keep_extended_class 186") And actually it is documented in |
Awesome! Thanks for that – I’ll give that a try.
|
Yes but be careful, the current released version of devtools::install_github("Jean-Romain/rlas") To support LAS 1.4 as well as LAS <= 1.3 in a consistent way I introduced a minor incompatibility with devtools::install_github("Jean-Romain/lidR") |
Edit: issue moved from lidR to rlas
First off thank you for this very helpful package. I'm not sure this is a bug or a known issue but...
I frequently use LAS files with classification numbers greater than 31. When I use
readLAS
with a-keep_class
filter greater than 31 I get a massive failure (R studio closes and must restart). To clarify this is an example of the code that causes the massive failure:This same line of code works fine if the
-keep_class
number is<= 31
. It would be great if this very helpful code would work for higher classification numbers.The text was updated successfully, but these errors were encountered: