write_raster_factors.Rd
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)
(character) Quoted full path to raster file.
(character) Unquoted name of the raster object in the R environment.
(character) Quoted name describing the raster value category (category, code, level would be common examples)
(logical) Overwrite an existing template if one exists.
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).
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.
Constructing the template can be extremely computationally and time intensive for large rasters.
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"
)
}