0

I am trying to create DTM rasters from a list of LAS files.

Code:

# Create a LAS catalog
LAS_List = readLAScatalog("path", recursive = TRUE)

# Create an output destination to store the DTM raster files
opt_output_files(LAS_list) <-  paste0("folder/{*}_dtm")

# Create a DTM using the TIN method
dtm_tin = rasterize_terrain(LAS_List, res = 1, algorithm = tin())

Now I am getting this error while running the rasterize_terrain() function:

Processing [=============>--------------]  52% (117/227) eta:  2hAn error occurred when processing the chunk 117. Try to load this chunk with:
 chunk <- readRDS("C:\Users\Arthur\AppData\Local\Temp\RtmpMxQWnM/chunk117.rds")
 las <- readLAS(chunk)
[writeRaster] file exists. You can use 'overwrite=TRUE' to overwrite it

How can I fix this?

5
  • Hi JRR, yes kinda, so in my code's case will opt_output_files$drivers$Raster$param$overwrite = TRUE will fix the issue? Or do I need to add anything else to the code too? Jun 9, 2023 at 18:14
  • I did try LAS_List_NE@opt_output_files$drivers$Raster$param$overwrite = TRUE but got an error Error in LAS_List@opt_output_files$drivers$Raster$param$overwrite = TRUE : no slot of name "opt_output_files" for this object of class "LAScatalog" Jun 9, 2023 at 19:18
  • Just copy paste the answer provided in the linked question (change the name of theLAScatalog)
    – JRR
    Jun 9, 2023 at 19:59
  • 1
    Well actually it may be rather normalizedctg@output_options$drivers$SpatRaster$param$overwrite <- TRUE because the output is with terra I guess
    – JRR
    Jun 9, 2023 at 20:25
  • Yup that worked, cheers. Jun 9, 2023 at 20:28

0

Browse other questions tagged or ask your own question.