0

When you use grid_terrain function in lidR with a catalog, the result is a virtual raster mosaic is returned (see gdalbuildvrt). But when i clic on (gdalbuildvrt) in pdf vignette, nothing is under the clic. How can i create a unique raster of this virtual result ?

1 Answer 1

0

If your question is: how to merge a virtual raster mosaic into a single file? I suggest you to ask another question with better tags because the question is not related to lidR. I'm going to anwer to the question: how to create a single raster instead of a virtual mosiac with lidR ?

When you use a function grid_* (terrain, canopy, density and so on) the output is a RasterLayer. When processing a LAScatalog you have access to all the feature of the processing engine including writing each chunk into a file on disk.

opt_output_files(ctg) <- "path/to/templated/filename_{ID}"

In the case of grid_* function several raster files are written on disk. By default the paths to the files are returned. But with rasters we can do something more clever and return an virtual raster mosaic instead of a list of path using gdalbuildvrt from gdalUtils.

This append only if you use a templated path to write the outputs. If you let it empty the regular behaviour returns a RasterLayer in memory.

opt_output_files(ctg) <- ""

Then you can write it into a file with raster::writeRaster.

Also you can't click on gdalbuildvrt in the pdf doc. It is a link to the documentation of a function from the package gdalUtils. Use the doc in R with ?grid_terrain

Notice that you can disable the virtual raster mosaic option with options(lidR.buildVRT = FALSE)

5
  • thank you for this response, it's ok. Commented Dec 11, 2019 at 7:53
  • how can i do to answered the questions ? Commented Dec 11, 2019 at 14:18
  • i have found the acceptance answer with the V in green near the answer ! Commented Dec 11, 2019 at 14:23
  • That's it!! Please do it every time an answer satisfies you in the future.
    – JRR
    Commented Dec 11, 2019 at 14:25
  • Yes, thanks for your help and your reactivity ! Commented Dec 12, 2019 at 9:44

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.