R lidR – How to Plot Multiple LAS Catalog Objects on a Single Leaflet Plot for Comparative Analysis

lidrr

I have five LAScatalog objects from five different subfolders present in the same parent folder. I would like to plot them together on an interactive Leaflet plot using lidR?

Please note that I know I can copy all the files into one folder, but the files are too many and R cannot handle those many points even though I do have 64 GB RAM.

How can I do this?

Sample Code:

library(lidR)

# Import the list of LAS files in the folder
FL_LAS_List = readLAScatalog("ParentFolder/SubFolder1")
BC_LAS_List_NE = readLAScatalog("ParentFolder/SubFolder2")
BC_LAS_List_NW = readLAScatalog("ParentFolder/SubFolder3")
BC_LAS_List_SW = readLAScatalog("ParentFolder/SubFolder4")
BC_LAS_List_SE = readLAScatalog("ParentFolder/SubFolder5") 

# Plot individual LAS objects
plot(FL_LAS_List, mapview = TRUE,
     map.type = "OpenStreetMap")

# Plot all five LAS catalog objects on a single map using the above plot code
# Stuck!!!....

Best Answer

I can see two options here.

Use only one collection

Either using

rbind(FL_LAS_List, BC_LAS_List_NE, BC_LAS_List_NW, ...)

or reading the files recursively from subfolders with

readLAScatalog("ParentFolder/", reccursive = TRUE)

Cast each catalog into sf objects

Then use mapview or other packages like leaflet

FL_LAS_List_sf = sf::st_as_sf(FL_LAS_List)
[...]
mapview::mapview(list(FL_LAS_List_sf, BC_LAS_List_NE_sf, ...))
Related Question