Clips a vector layer using a polygon layer. It handles CRS transformations automatically if necessary, ensuring the output is in the same CRS as the input polygon.
Value
An `sf` object containing the features of the input `vector` that intersect with the `polygon`. The output will be in the CRS of the `polygon`, and it will retain all attributes of the input `vector`.
See also
Other clip functions:
clip_multipoligon()
,
clip_raster()
,
generate_bbox()
Examples
gpkg_path <- system.file("extdata", "clc.gpkg", package = "clc")
clc <- sf::st_read(gpkg_path, layer = "clc", quiet = TRUE)
lanjaron <- sf::st_read(gpkg_path, layer = "lanjaron", quiet = TRUE)
clc_clipped <- clip_layer(clc, lanjaron)