Align vector CRS to raster's
See also
Other Helper functions:
any_class_args()
,
clip_ras_ext()
,
clip_vec_ext()
,
crs_check()
,
datamod()
,
dep_check()
,
dep_switch()
,
ext2poly()
,
get_clip_ext()
,
is_bbox_within_reference()
,
is_within_ref()
,
par_def_q()
,
reproject_std()
,
vect_valid_repair()
Examples
library(terra)
library(sf)
options(sf_use_s2 = FALSE)
ncpath <- system.file("gpkg/nc.gpkg", package = "sf")
elev <- system.file("ex/elev.tif", package = "terra")
nc <- terra::vect(ncpath)
elev <- terra::rast(elev)
reproject_b2r(nc, elev)
#> class : SpatVector
#> geometry : polygons
#> dimensions : 100, 14 (geometries, attributes)
#> extent : -84.32377, -75.45658, 33.88216, 36.58977 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> names : AREA PERIMETER CNTY_ CNTY_ID NAME FIPS FIPSNO CRESS_ID
#> type : <num> <num> <num> <num> <chr> <chr> <num> <int>
#> values : 0.114 1.442 1825 1825 Ashe 37009 3.701e+04 5
#> 0.061 1.231 1827 1827 Alleghany 37005 3.7e+04 3
#> 0.143 1.63 1828 1828 Surry 37171 3.717e+04 86
#> BIR74 SID74 (and 4 more)
#> <num> <num>
#> 1091 1
#> 487 0
#> 3188 5