mesh_to_dem {habtools}R Documentation

Transform 3D mesh to DEM

Description

Turns a 3D mesh file into a Digital Elevation Model (DEM) of class RasterLayer format.

Usage

mesh_to_dem(mesh, res, fill = TRUE)

Arguments

mesh

A mesh3d object.

res

(Optional) The desired DEM resolution in same units at the 3D mesh.

fill

Logical. Fill NA values in raster with minimum value?

Details

The function rasterizes uses the vertices of the mesh file. If resolution is not given, it is calculated by finding the maximum nearest neighbor of vertices projected on the xy plane. fill is used when irregular 3D meshes result in NA values in raster cells. The default is to fill these cells with the minimum, non-NA raster value.

Value

A dem of class RasterLayer.

Examples

dem <- mesh_to_dem(mcap)
raster::plot(dem)

dem <- mesh_to_dem(mcap, res = 0.05)
raster::plot(dem)

# Don't fill empty raster cells
dem <- mesh_to_dem(mcap, res = 0.02, fill = FALSE)
raster::plot(dem)


[Package habtools version 1.0.5 Index]