toRaster: Voxel layer to raster

View source: R/Utils-voxel.R

toRasterR Documentation

Voxel layer to raster

Description

Converts a voxel space (i, j) layer into a terra::SpatRaster object.

Usage

toRaster(vxsp, vx)

Arguments

vxsp

a VoxelSpace object.

vx

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.

Value

a terra::SpatRaster object.

Examples

## Not run: 
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)]))

## End(Not run)


AMAPVox documentation built on June 22, 2024, 12:03 p.m.