readDTM: FUSION R command line interface - Read DTM format files and...

View source: R/UtilityFunctions.R

readDTMR Documentation

FUSION R command line interface – Read DTM format files and return a matrix, RasterLayer, or SpatRaster object

Description

readDTM reads surface and raster data stored in FUSION's DTM format and returns information related to the DTM.

Usage

readDTM(
  fileName = NULL,
  type = "matrix",
  epsg = NULL,
  crs = NULL,
  negativeToNA = TRUE
)

Arguments

fileName

character (required): Name of the DTM format file containing data to be read.

type

character: Desired return type: "matrix" for data values in a matrix, "terra" for SpatRaster object compatible with the terra package, "raster" for a RasterLayer object compatible with the raster package, and "header" to return the DTM file header as a data frame.

epsg

numeric: EPSG code defining the projection for the data. This is assigned to the SpatRaster object when type = "terra" or the RasterLayer object when type = "raster". You can only specify one of epsg or crs, not both.

crs

character: PROJ.4 type description of a Coordinate Reference System (map projection). You can only specify one of epsg or crs, not both.

negativeToNA

boolean: Replace negative values with NA (TRUE) or leave negative values as is (FALSE). Setting this to FALSE to preserve negative values can lead to erroneous values for the minimum value when writing the data to a new DTM using writeDTM.

Details

When type = "matrix" (default), the return is a matrix containing the values. Matrix element [1,1] is the value in upper left corner.

When type = "terra", the return is a SpatRaster object compatible with the terra package.

When type = "raster", the return is a RasterLayer object compatible with the raster package.

Value

Return value depends on type. If type = "matrix", return value is a (invisible) matrix containing the values. If type = "terra", return value is a (invisible) SpatRaster object compatible with the terra package. If type = "raster", return value is a (invisible) RasterLayer object compatible with the raster package. If type = "header", return type is a data frame with the header parameters.

See Also

Other helpers: readLDA(), writeDTM()

Examples

## Not run: 
df <- readDTM("surface.dtm")
dtm <- readLDA("surface.dtm", type = "raster", epsg = 26910)

## End(Not run)

bmcgaughey1/fusionwrapr documentation built on Dec. 1, 2024, 7:13 a.m.