1

I am trying to compute the actual incidence angles. The following is the code that I used based on the example in the lidR book

Code:

ang_calc = function(cluster, traj)
{
  las = readLAS(cluster)
  if (is.empty(las))return(NULL)
  las <- lastraj(las, traj, use.fun = TRUE)
  print(names(las@data))
  las <- lasangles(las, traj = c("xtr", "ytr", "ztr") )
  print(names(las@data))
  return(las)
}

output <- catalog_apply(lasc, ang_calc, traj)

The print commands confirm that the additional attributes are being added after each function. However, the final point cloud that is written on disk has none of the additional attributes. There was the following warning:

1: In regularize.values(x, y, ties, missing(ties), na.rm = na.rm) :
  collapsing to unique 'x' values

Just to test, I only read the cluster in the function and returned it without doing any thing. There was no warning and there was no difference in the files written on disk in both the cases.

3
  • 1
    You example is not reproducible. We don't know what is lastraj() or lasangles(). We don't have any data to reproduce. My guess is that you missed the function add_lasattribute(). Also, the warning likely to come from your code, there is nothing is lidR that is called regularize.values()
    – JRR
    Commented Oct 17, 2020 at 16:39
  • 1
    Also fix catalog_apply(lasc, ang_calc, traj = traj)
    – JRR
    Commented Oct 17, 2020 at 19:27
  • Hello, thanks for your reply! I will test if a basic add_lasattributes() works and perhaps answer this post if possible.
    – K_D
    Commented Oct 17, 2020 at 19:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.