1

I am unfortunately dependent on an older version (4.0.4) of the lidR package due to a package dependency. Strangely enough, the import of LAS files with readLAS() no longer works since a system update. The problem seems to occur with all older package versions except for the current version. Below you will find a code example that produces the error for me.

# install lidR package version 4.0.4
remotes::install_version("lidR", "4.0.4")

# load package
library(lidR)

# get example file path
LASfile <- system.file("extdata", "Megaplot.laz", package = "lidR")

# read las file
las <- readLAS(LASfile)

Error: Not compatible with requested type: [type=character; target=double].

Is this behavior intentional or am I doing something wrong?

I am using R version 4.4.1 under Ubuntu 22.04.4 LTS.

1 Answer 1

1

The backward incompatibility arises from changes to CRAN policies, which required us to remove certain C++ dependencies from the rlas package, responsible for reading and writing LAS/LAZ files. To preserve functionality, we had to make internal changes in rlas that introduced backward incompatibilities. However, this shouldn't affect users as long as they keep their packages up to date.

In your case, the issue seems to stem from using an outdated version of lidR with the newer version of rlas. Downgrading to an older version of rlas might resolve the issue, but I’m more concerned that you feel the need to stick with version 4.0.4. It's quite old, and numerous bugs have since been fixed. I suspect your issue might lie elsewhere.

2
  • 1
    Thank you very much. That has solved the problem. In fact, I would also prefer to work with the latest version. The original problem is that I get the error 'extent' is not an exported object from 'namespace:lidR' when using the latest version of lidR with the unofficial package I depend on. If you can think of a reason for this, I would be very pleased.
    – Peter
    Commented Sep 20 at 9:13
  • 1
    Yes, I removed it because raster is a retired package and lidR no longer depends on it. If you copy the original code you can get it working I guess github.com/r-lidar/lidR/commit/…
    – JRR
    Commented Sep 20 at 13:28

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.