convert_raster | R Documentation |
Function to convert between raster formats. Use pkg = "terra|raster|stars" to get an output in SpatRaster, RasterLayer or stars format. Default is getOption("lidR.raster.default").
convert_raster(r, pkg = NULL)
r |
raster object or file name. |
pkg |
package name. Use pkg = "terra| stars" to get an output in SpatRaster or stars format |
A raster object in the specified format
# load SpatRaster
data(chm_chablais3)
chm_chablais3 <- terra::rast(chm_chablais3)
# convert only if packages stars and raster are installed
# if (require("stars"))
# {
# to stars
# chm_stars <- convert_raster(chm_chablais3, pkg = "stars")
# chm_stars
# convert_raster(chm_stars, pkg = "terra")
# }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.