Skip to content
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

Unable to load las or laz files #53

Closed
denzle83 opened this issue Jul 3, 2021 · 6 comments
Closed

Unable to load las or laz files #53

denzle83 opened this issue Jul 3, 2021 · 6 comments
Assignees
Labels
Bug A bug in the package

Comments

@denzle83
Copy link

denzle83 commented Jul 3, 2021

Hi,

I'm having trouble opening my las files. Where just last week everything was fine, now nothing seems to load. I've moved files from my own dir to the lidR one, have compressed the files to LAZ and tried every conceivable method to load them but either receive:

  • Error: File does not exist.
    or
  • Error: Invalid header: 'description' must be a string of length < 32 in extra bytes description

I've searched for any information relating to the 'Invalid header' but find nothing of help. I have updated R and RStudio to the latest as well uninstalling and re-installing everything and installing an older version. Also renaming the files to see if that has any impact but nothing seems to work. Do you have any ideas what could be the cause?

Many thanks
Dan

@Jean-Romain
Copy link
Collaborator

Can you share the file ?

@denzle83
Copy link
Author

denzle83 commented Jul 3, 2021

Many thanks for your quick reply. I've left a OneDrive link for the las files, if you have any problems accessing it or use a different drive just let me know i'll add them to your preferred cloud.

I have found that using read.las instead of readLAS seems to allow files to be opened but then unable to run any other functions ie classify ground or normalise.

https://1drv.ms/u/s!AsVBoyyYmzOCgjvpNXNAKIMOY4xl?e=Z7uHvA

Regards
Dan

@Jean-Romain
Copy link
Collaborator

Jean-Romain commented Jul 4, 2021

I have a different issue.

 Error in nchar(extra_byte[["description"]]) : 
  invalid multibyte string, element 1 

Anyway it is an issue with rlas. I think it badly reads a 32 characters string that is not NUL-terninated . Reproducible example:

h = rlas::read.lasheader("hen_faes_plot3_lidar.laz")
h
#>  [...]
#> $`Variable Length Records`$Extra_Bytes$`Extra Bytes Description`$NormalZ$description
#> [1] "Z component of a vector normal t0\032\0056\xfc\177"

Moved to rlas

@Jean-Romain Jean-Romain transferred this issue from r-lidar/lidR Jul 4, 2021
@Jean-Romain
Copy link
Collaborator

Jean-Romain commented Jul 4, 2021

Two workarounds in lidR before I find a fix.

Do not read extra bytes

This way the header will be modified to remove information about extra bytes and it will consequently not trigger any error

las = readLAS("hen_faes_plot3_lidar.laz", select = "-0")

Create a LAS object manually

p = rlas::read.las("hen_faes_plot3_lidar.laz", filter = "-keep_random_fraction 0.01")
h = rlas::read.lasheader("hen_faes_plot3_lidar.laz")
h$`Variable Length Records`$Extra_Bytes$`Extra Bytes Description`$NormalZ$description = "Z component of a vector normal t"
las = LAS(p, h)

@Jean-Romain Jean-Romain self-assigned this Jul 4, 2021
@Jean-Romain Jean-Romain added the Bug A bug in the package label Jul 4, 2021
@denzle83
Copy link
Author

denzle83 commented Jul 4, 2021

Thank you for the work arounds they are a great help and greatly appreciated.

Dan

@Jean-Romain
Copy link
Collaborator

The bug is expected to be fixed. Please install rlas 1.5.1 and tell me if it works well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the package
Projects
None yet
Development

No branches or pull requests

2 participants