Skip to contents

Check if the boundary of the vector/raster object is inside the reference

Usage

is_within_ref(input_object, reference)

Arguments

input_object

sf/stars/SpatVector/SpatRaster object.

reference

sf/stars/SpatVector/SpatRaster object.

Value

logical

Author

Insang Song geoissong@gmail.com

Examples

library(sf)
sf_use_s2(FALSE)
ncpath <- system.file("shape/nc.shp", package = "sf")
nc <- sf::read_sf(ncpath)
nc <- sf::st_transform(nc, "EPSG:4326")
mainland_vec <- c(xmin = -128, xmax = -62, ymin = 22, ymax = 52)
mainland_box <- ext2poly(mainland_vec, output_class = "sf")
within_res <- is_within_ref(nc, mainland_box)
#> although coordinates are longitude/latitude, st_covered_by assumes that they
#> are planar
within_res
#> [1] TRUE