Skip to contents

Clip input vector by the expected maximum extent of computation.

Usage

clip_vec_ext(pnts, radius, target_input)

Arguments

pnts

sf or SpatVector object

radius

numeric(1). Circular buffer radius. this value will be automatically multiplied by 1.1

target_input

sf or SpatVector object to be clipped

Value

A clipped sf or SpatVector object.

Author

Insang Song

Examples

library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
library(stars)
#> Loading required package: abind
library(terra)
options(sf_use_s2 = FALSE)

bcsd_path <- system.file(package = "stars", "nc/bcsd_obs_1999.nc")
bcsd <- stars::read_stars(bcsd_path)
#> pr, tas, 
bcsd <- sf::st_as_sf(bcsd)
bcsd_rpnt <- sf::st_as_sf(sf::st_sample(bcsd, 4L))
bcsd_rpntm <- sf::st_as_sf(sf::st_sample(bcsd, 1000L))
clip_vec_ext(bcsd_rpntm, 1000, bcsd_rpnt)
#> Clip target features with the input feature extent...
#> Simple feature collection with 4 features and 0 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -82.93117 ymin: 33.02974 xmax: -77.41361 ymax: 34.6201
#> CRS:           NA
#>                            x
#> 1 POINT (-81.62004 34.58888)
#> 2  POINT (-77.41361 34.6201)
#> 3 POINT (-82.93117 33.02974)
#> 4 POINT (-80.22347 34.50031)