View source: R/write_raster_factors.R
write_raster_factors | R Documentation |
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)
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. |
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.
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).
write_raster_factors
will take as input either an object of
class raster that is already in the environment (raster_entity
) or
will read a raster file (raster_entity
) given a path and filename.
Constructing the template can be extremely computationally and time intensive for large rasters.
## Not run:
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"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.