4

As new or updated LAS data is received, I would like to be able to integrate that into the surrounding data of the area (for normalized data, CHMs, etc. for example). I.e. I want to insert "patches" that take advantage of lidR's buffering capability, but to have LAS files organized in different spots (e.g. based on date acquired). I don't think lidR is meant as a data management tool but binding catalogs together with catalog_intersect might be helpful in this case. edit: or ctg$processed instead of catalog_intersect

edit July 05, 2022: update following the answer from below. This is an alternative to using list.files() that may be helpful. It reads in a csv file that has been put together and edited outside of R so specific las/laz files could be targeted.

# ---------------------------------------------------------------------------
library(readr)
library(lidR)
# ---------------------------------------------------------------------------

# ---------------------------------------------------------------------------
# Alternative to list.files('D:/Test/LASLAZ', pattern = '*.la*')
#
# First prepare a list of las or laz files through the dos prompt:
# dir *.la* /B /A-D /S > laslazList.csv
# ---------------------------------------------------------------------------

setwd("D:/Test/")

LASfiles_Raw <- read_csv('laslazList.csv', col_names = 'filename')
LASfiles_Raw <- as.list(LASfiles_Raw$filename)
LASfiles_Raw <- as.character(LASfiles_Raw[])

ctg <- readLAScatalog(LASfiles_Raw,
                      progress = TRUE,
                      select = "xyzcr",
                      filter = "-drop_withheld -drop_overlap -drop_z_below -5")
plot(ctg)

1 Answer 1

4

You can totally have a LAScatalog where the LAS files are stored in different folders. The simplest is to have a root folder

project/
|__ subfolder1/
|__ subfolder2/
    |__ subsubfolder1/
    |__ subsubfolder2/

In this case you can simply use

ctg = readLAScatalog("project/", recursive = TRUE)

For more complex folder architectures (e.g. you don't want all the files to be included ; you don't have a root project or whatever) you can programatically list all the LAS files you want with R functions like list.files() and give a vector of files to readLAScatalog()

ctg = readLAScatalog(vector_of_file_paths)

However you cannot bind two LAScatalog it becomes a SpatialPolygonsDataFrame by inheritance and because lidR does not define bind functions. This might be a good feature request btw

rbind(ctg1, ctg2)
#> class : SpatialPolygonsDataFrame 

edit: rbind added in lidR 3.2.0

rbind(ctg1, ctg2)
#> class : LAScatalog
2
  • Perfect. So now I can read files in the new folder, remove the old files based on name or location, and create a new catalog to work with. How do I make a feature request? A catalog_replace would save a few steps for me!
    – Ray J
    Mar 18, 2021 at 14:09
  • 1
    Feature request on github or if you don't have a github account send an email.
    – JRR
    Mar 18, 2021 at 14:10

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.