RLAStools: Call LAStools functions from R

View source: R/RLAStools.R

RLAStoolsR Documentation

Call LAStools functions from R

Description

Run LAStools functions from R interface

Usage

RLAStools(LAStoolsDir = "", LAStool, input, arguments = NULL)

Arguments

LAStoolsDir

Character Path. Path to LAStools bin folder. Default is "" - where users have set the LAStools/bin folder to environment variables.

LAStool

Character. Name of LAStools to use.

input

Character Path. Input files path.

arguments

Character string. Desired switches to be performed.

Note

Adapted from LAStools Google Group Thread: OP - Luiz Estraviz

Examples

## Not run: 
#--- Define input ---#
input  = "F:/test"

# Define las/laz files to be processed
inFiles  = glue::glue("{input}/*.laz")

# Define output directory (and creates it ... if doesn't exist)
outDir = glue::glue("{input}/info")

dir.create(outDir, showWarnings = F)

RLAStools(LAStool = "lasinfo",
          input = inFiles,
          cores = 4,
          arguments = glue::glue("-v -odix _info -otxt -odir {outDir}"))

## End(Not run)

#--- batch ---#

dirs <- list.dirs("F:/lidar_folders", recursive = FALSE)

for(i in 1:length(dirs)){

  odir <- glue::glue("{dirs[i]}/laz")

  dir.create(odir)

  iRss::RLAStools(LAStool = "las2las", input = glue("{dirs[i]}/*.laz"), arguments = glue::glue("-odir {odir} -olaz -cores 8") )

}


tgoodbody/iRss documentation built on March 20, 2022, 8:27 p.m.