Converts a table of tree data into a standardized spatial format with consistent naming, and units and coordinate reference system to work with any user data storage convention. This function prepares the input data to be used as part of a `TreeMapMatchinh` object for tree matching and analysis.

standardize(data, xname, yname, zname, zunits = "cm", crs = sf::NA_crs_)

Arguments

data

A `data.frame` or `sf` object with tree records .

xname

Name of the column containing X coordinates (no used with sf objects).

yname

Name of the column containing Y coordinates (no used with sf objects).

zname

Name of the column containing the Z dimension. Usually DBH (Diameter at Breast Height) values or tree height.

zunits

Unit of the zname values. Either `"cm"` (default) or `"m"` or `"mm"`. If "cm" or "mm" the value will be converted to meters.

crs

Coordinate Reference System to assign to the output geometry (as a `sf::st_crs()` object).

Value

An `sf` object with:

  • Geometry from the X and Y columns.

  • A new column `ZDIM` in meters

  • CRS set as specified.

  • An attribute `"standardized" = TRUE`.

See also

st_as_sf, st_crs, rename_with

Examples

data(PRF025_Field)
tree_map <- standardize(
  PRF025_Field,
  xname = "Field_Xpj",
  yname = "Field_Ypj",
  zname = "DBH",
  zunits = "cm",
  crs = 2959)