toRaster.Rd
Converts a voxel space (i, j) layer into a
terra::SpatRaster
object.
toRaster(vxsp, vx)
a VoxelSpace
object.
a voxel space horizontal slice. A data.table with i, j
columns
and least one additional variable, the value of the raster layer. Every
column beside i and j will be converted into a raster layer.
a terra::SpatRaster
object.
if (FALSE) {
vxsp <- readVoxelSpace(system.file("extdata", "tls_sample.vox", package = "AMAPVox"))
library(terra)
# CHM, DEM and PAI as raster
plot(toRaster(vxsp, merge(canopyHeight(vxsp), groundElevation(vxsp), all = T)))
# PAI
vxsp <- plantAreaDensity(vxsp)
pai <- plantAreaIndex(vxsp, type = "xy", pattern.pad = "pad_transmittance")
plot(toRaster(vxsp, pai))
# sampling intensity at 2 meters
plot(toRaster(vxsp, vxsp@data[ground_distance == 2.25, .(i, j, nbSampling)]))
}