cut_to_extent: Clip the Layer with a Polygon

View source: R/clc.R

cut_to_extentR Documentation

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 class 'clc'
cut_to_extent(clo, polygon)

Arguments

clo

A 'clc' object.

polygon

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

Value

A 'clc' object.

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

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)


clc documentation built on April 4, 2025, 5:17 a.m.