View source: R/UtilityFunctions.R
writeDTM | R Documentation |
writeDTM
writes FUSION's DTM format files from data contained in a matrix, RasterLayer, or SpatRaster object. Any NA values
in the data are converted to a value of -1 indicating areas with invalid data. This means that values must all be
greater than 0 for use with any of the FUSION tools. While it is possible to store data with negative values, there
are much better formats for data than FUSION's DTM format.
writeDTM(
x,
fileName = NULL,
description = "DTM written by fusionwrapr R package",
xyunits = NULL,
zunits = NULL,
coordsys = NULL,
zone = NULL,
horizdatum = NULL,
vertdatum = NULL,
originX = NULL,
originY = NULL,
columnSpacing = NULL,
rowSpacing = NULL,
rotate = TRUE,
storageFormat = -1
)
x |
(required): data object containing the values to be written to the DTM file. This can be a simple
matrix, a SpatRaster object, or a SpatialLayer object. Values are assumed to be in rows with the first row and column
in the upper left corner. Use |
fileName |
character (required): Name for the DTM format file. |
description |
character: Descriptive name for the DTM. Default is "DTM written by fusionwrapr R package". Length will be truncated to 60 characters. |
xyunits |
character (required): Units for LIDAR data XY (M for meters, F for feet, O for other or unknown). |
zunits |
character (required): Units for LIDAR data elevations (M for meters, F for feet, O for other or unknown). |
coordsys |
numeric (required): Coordinate system for LIDAR data: 0 for unknown 1 for UTM 2 for state plane) |
zone |
numeric (required): Coordinate system zone for LIDAR data (0 for unknown). |
horizdatum |
numeric (required): Horizontal datum: 0 for unknown 1 for NAD27 2 for NAD83 |
vertdatum |
numeric (required): Vertical datum: 0 for unknown 1 for NGVD29 2 for NAVD88 3 for GRS80 |
originX |
numeric (required when |
originY |
numeric (required when |
columnSpacing |
numeric (required when |
rowSpacing |
numeric (required when |
rotate |
boolean: Flag indicating grid of values needs to be rotated before being written to |
storageFormat |
integer: Integer value indicating the numeric type for
values stored in the DTM file. The default value (-1) indicates that the
actual data type of the data object is used to dictate the appropriate
format. Storage options when |
FUSION DTM format files do not carry any projection information that is useful to other tools. FUSION tools use the minimal projection information stored in DTM files to prevent merging of files with different projections or mixing analyses using files with different projections. The enforcement for projection-related information is fairly lax in FUSION's tools and, while I would like to enhance this information, it is not likely to change.
This function is particularly useful for converting surfaces into the DTM format. A simple test using the raster package to read a surface in TIF format and write to the DTM format was over 10 times faster that using gdal_translate to convert the TIF file to ASCII raster and then using FUSION's ASCII2DTM program to convert to DTM format.
Returns an invisible boolean value indicating success (TRUE) or failure (FALSE).
Other helpers:
readDTM()
,
readLDA()
## Not run:
writeDTM(rast, "test.dtm")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.