4

Everything is in the title, I would like to save all the tiles from a LAScatalog in one las file. I don't want to store all the tiles in one folder, just one file (because I found it more convenient for the organization of my storage device).

Is there a better way than a dirty loop loading the tiles and merging with rbind.LAS?

1 Answer 1

6

Yes, at least two better solutions.

The first one applies if your entire point-cloud is not too big i.e. it fits in memory (which is what you plan to do reading all files). You can simply read all files as one.

ctg = readLAScatalog("folder/")
las = readLAS(ctg)

This is pretty similar to your solution but all the rbind.LAS job is done internally at the C++ level in a much more memory efficient way.

The second solution is much better and works even if the merged point-cloud does not fit in memory by streaming the points into a single output file. See the chapter about retiling in the lidR book. The idea is to retile but with a chunk size larger than the whole collection. Something like that should work:

opt_output_files(ctg) <- "folder/singlefilename"
opt_chunk_buffer(ctg) <- 0
opt_chunk_size(ctg) <- 10000
singlefile_ctg <- catalog_retile(ctg)
0

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.