Learn R Programming

clc (version 1.0.0)

cut_to_extent: Clip the Layer with a Polygon

Description

This function clips the object layer using a polygon layer. It handles CRS transformations automatically if necessary, ensuring the output is in the same CRS as the input polygon.

Usage

cut_to_extent(clo, polygon)

# S3 method for clc cut_to_extent(clo, polygon)

Value

A `clc` object.

Arguments

clo

A `clc` object.

polygon

An `sf` object representing the polygon layer used for clipping.

See Also

Other CLC class functions: as_raster(), clc(), copy_to(), get_colors.clc(), get_levels.clc(), get_raster(), plot_clc(), prepare_plot(), save_to()

Examples

Run this code
source_gpkg <- system.file("extdata", "clc.gpkg", package = "clc")
clo <- clc(source = source_gpkg, layer_name = "clc")

polygon <- sf::st_read(source_gpkg, layer = 'lanjaron', quiet = TRUE)

clo2 <- clo |>
        cut_to_extent(polygon)

Run the code above in your browser using DataLab