0

I am trying to work with a las file from photogrammetry that is one tile from a retiled lascatalog. The las (v1.2) file is linked below. My issue occurs with other tiles too.

I can load the file using readLAS and can plot(las) but I get errors for las_check(las), decimate_las(las), and just trying to get the summary by typing las into the console.

This is the error: Error in UseMethod("st_crs<-") : no applicable method for 'st_crs<-' applied to an object of class "bbox"

Reproducible workflow:

  1. Download data (https://drive.google.com/file/d/1CbcXRrGypQm3D0_adPzdRajt9OXHmXX0/view?usp=sharing)
  2. las <- lidR::readLAS(file)
  3. las_check(las)

I'm using lidR version 4.0.0 in RStudio 1.3.1056.

10
  • Link to data isn't working.
    – Pointdump
    Mar 9, 2022 at 21:24
  • @Pointdump: fixed Mar 9, 2022 at 21:29
  • Please provide a minimal reproducible example. What is not working? las_check? decimate_las (This function does not exist)? or print? I tried las_check and print and it worked.
    – JRR
    Mar 9, 2022 at 22:17
  • Not sure what else to offer. This is a las_check workflow that causes the error for me on the provided data. There are a number of other functions that lead to the same error including "print". Maybe this is a version issue for a lidR dependency? Mar 9, 2022 at 22:44
  • I wonder if somehow your LAS data is storing the projection reference in a depreciated format. The decimate function is lidR::decimate_points. I have been using this package at this version for the past few days and have not seen any of the behavior you describe. You may want to make sure that all of your packages are up to date ie., run update.packages or select from the Packages menu in the R Console. I would also make sure that you are running R 4.1.0 and try running from the Console to rule out RStudio issues. Mar 10, 2022 at 0:04

1 Answer 1

2

It looks like lidR versions 3.x are having some issues with compatibility with other packages. Here's a reproducible (for me anyway) example:

> library(lidR)
Loading required package: raster
Loading required package: sp
lidR 3.1.4 using 2 threads. Help on <gis.stackexchange.com>. Bug report on <github.com/Jean-Romain/lidR>.
Warning messages:
1: multiple methods tables found for ‘direction’ 
2: multiple methods tables found for ‘gridDistance’ 
3: multiple methods tables found for ‘area’ 

Some warnings we can probably ignore. Okay let's run the first example in the help for readLAS:

>  LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
>      las = readLAS(LASfile)
Error in (function (cl, name, valueClass)  : 
  assignment of an object of class “logical” is not valid for @‘proj4string’ in an object of class “LAS”; is(value, "CRS") is not TRUE

With these versions of sp and sf:

> packageVersion("sp")
[1] ‘1.4.5’
> packageVersion("sf")
[1] ‘1.0.1’

That's not looking good... But reinstalling lidR up to version 4.0.0 and its now fully working.

3
  • multiple methods tables are typical errors coming from nowhere and related somehow to an installation issue. I encountered that on windows and the errors were resolved by reinstalling a clean R version. The proj4string issue is also a problem of corrupted binaries reported here github.com/r-lidar/lidR/issues/485 and unsolvable on my side. Both lidR 3.2.0 and 4.0.0 are working good but many troubles on which I have no control happen with bad/weird windows binaries. Sometime it is only tempory and it is fixed when the CRAN generates a new binary. It is not reproducible by everybody.
    – JRR
    Mar 10, 2022 at 11:07
  • How about I accept this answer if some of JRR's thoughts from the comment are incorporated to provide more general context? Mar 10, 2022 at 15:10
  • I'm not sure. I might just delete this. I'm not even using binaries, building all packages from source. I sort of want to downgrade and see if I can re-break things and really track down the error, but I sort of don't want to, because upgrading to 4.0.0 seems like the first thing you should do anyway. Meh...
    – Spacedman
    Mar 10, 2022 at 16:47

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.