Returns an object of class `clc_raster` that contains a `terra::SpatRaster` raster object representing the converted vector layer into raster format.
Usage
as_raster(clo, base_raster, resolution)
# S3 method for class 'clc'
as_raster(clo, base_raster = NULL, resolution = NULL)
Details
The function requires either `base_raster` or `resolution` to be provided. If both are missing, an error is raised.
See also
Other CLC class functions:
clc()
,
copy_to()
,
cut_to_extent()
,
get_colors.clc()
,
get_levels.clc()
,
get_raster()
,
plot_clc()
,
prepare_plot()
,
save_to()
Examples
source_gpkg <- system.file("extdata", "clc.gpkg", package = "clc")
clo <- clc(source = source_gpkg, layer_name = "clc")
raster_path <- system.file("extdata", "mdt.tif", package = "clc")
base_raster <- terra::rast(raster_path)
# ex1
r <- clo |>
as_raster(base_raster = base_raster)
# ex2
r <- clo |>
as_raster(resolution = 50)