Learn R Programming

lidR (version 1.2.1)

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, ...)

Arguments

x

a lasmetrics object

z

character. If 3 columns or more, the field to extract. If NULL return a RasterStack.

unused

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.SpatialPixelsDataFrame, as.SpatialPointsDataFrame, as.lasmetrics

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