write_raster_factors creates a template as a yaml file for supplying code definition metadata for spatial rasters if raster values are categorical.

write_raster_factors(raster_file, raster_entity, value_name, overwrite = FALSE)

Arguments

raster_file

(character) Quoted full path to raster file.

raster_entity

(character) Unquoted name of the raster object in the R environment.

value_name

(character) Quoted name describing the raster value category (category, code, level would be common examples)

overwrite

(logical) Overwrite an existing template if one exists.

Value

A template for providing code definition metadata as a yaml file with the file name of the raster + "_factors.yaml" (created in the working directory).

Details

Generate a yaml template file that supports the ability to provide a definition for each level or categorical type. The resulting yaml file is written with the name of the raster file + "_factors". The create_spatialRaster function will search for this file when creating a EML spatialRaster entity.

Note

Constructing the template can be extremely computationally and time intensive for large rasters.

Examples


if (FALSE) {

capemlGIS::write_raster_factors(
 raster_entity = denp3p1,
 value_name    = "lulc_codes"
)

capemlGIS::write_raster_factors(
 raster_file = "file-path-to/denp3p1.img",
 value_name  = "weight_class_bins"
)

}