Open manmatej opened 9 months ago
Hi @manmatej
Thanks for the detailed explanation of the problem and example data. I can confirm that passing anything but a path to a single LiDAR file as input
will cause the errors you encounter.
You need to set the Whitebox working directory. In your sample code you try using setwd()
which alters the R working directory but not the Whitebox working directory.
Use wbt_wd()
instead to set path to your "laz"
folder, then using input=""
will cause all .laz files to be processed to .tif.
The manual states:
Note that if an input LiDAR file (--input) is not specified by the user, the tool will search for all valid LiDAR (.las, .laz, *.zlidar) files contained within the current working directory.
Note you need not specify --output
because the .tif file names will be derived from the input LiDAR file base name.
See this example (using whitebox-tools v2.3.0):
library(whitebox)
my_wd <- "~/gh/whiteboxR/116/cuzk-process/laz"
wbt_wd(my_wd)
# input is empty, whitebox uses the whitebox working directory
wbt_lidar_tin_gridding(
input = "",
parameter = "elevation",
returns = "all",
resolution = 10)
Quickly inspecting the results:
library(terra)
outfiles <- list.files(my_wd, full.names = TRUE, pattern = "tif")
# view individual tiles
res <- sapply(sprc(outfiles), plot)
# view combined
plot(vrt(outfiles))
As the current code in whitebox R package v2.3.1 is set up it is not possible to pass NULL
input
argument. Therefore you need to set input=""
in the call to wbt_lidar_tin_gridding()
to use the whitebox working directory.
Luckily, whitebox-tools appears to treat --input=""
equivalently to not passing --input
at all. Since input
is optional, I should refactor the code to conditionally handles input
so that it can be be left out of the call entirely .
Hello,
I am currently working with LidarTinGridding in R using Whitebox in RStudio. I have a directory containing numerous laz files and I'd like to take advantage of Whitebox's capability to process them all together in order to reduce edge effects, as demonstrated in the Whitebox Tools user manual: Whitebox Tools Manual.
I'm attempting to provide the input folder as an argument or a list of files to the function, but I'm encountering an issue where I still receive a "permission denied" error. I've tried running RStudio as an administrator and moving the input files to as many public folders as possible, but I'm still encountering the same permission denied problem.
When I work with a single file, everything runs smoothly. However, I'm wondering how to process multiple files. Is this option implemented in R whitebox?
You can find my code and sample tiles in this GitHub repository: GitHub Repository. The folder named "laz" contains two sample tiles processed with the script testing_whitebox.R.
My sessioninfo:
The error I am getting: