Learn R Programming

lidR (version 1.4.2)

as.raster.lasmetrics: Transform a lasmetrics object into a spatial RasterLayer object

Description

Transform a lasmetrics object into a spatial RasterLayer object

Usage

# S3 method for lasmetrics
as.raster(x, z = NULL, fun.aggregate = mean, ...)

Arguments

x

a lasmetrics object

z

character. If 3 columns or more, the names of the field to extract. If NULL returns a RasterStack instead of a RasterLayer.

fun.aggregate

Should the data be aggregated before casting? If the table does not contain a single observation for each cell, then aggregation defaults to mean value with a message.

...

Internal use only.

Value

A RasterLayer object from package raster or a RasterStack if there are several layers.

See Also

grid_metrics grid_canopy grid_canopy raster

Other cast: as.lasmetrics, as.spatial

Examples

Run this code
# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)

meanHeight = grid_metrics(lidar, mean(Z))
rmeanHeight = as.raster(meanHeight)
# }

Run the code above in your browser using DataLab