How to save my dtm generated from LAS point cloud as tiff file in lidR package?

138 views Asked by At

I am trying to save the dtm generated using plot command. The dtm has been generated from las using lidR using this code

dtm1_tin <- rasterize_terrain(las1, res = 1, algorithm = tin())
plot_dtm3d(dtm1_tin, bg = "white")
 
# Trying to save my plot using
savePlot("dtm1_tin", type = "tiff", device = dev.cur(), restoreConsole = TRUE)
#> Error in savePlot("dtm1_tin", type = "tiff", device = dev.cur(), restoreConsole = TRUE) : 
no such device
1

There are 1 answers

0
aclong On

Looks like you should be able to use the generic terra::writeRaster with your dtm1_tin object.

So:

terra::writeRaster(dtm1_tin, "your_data_dir/your_file_name.tif", filetype = "GTiff", overwrite = TRUE)