if (FALSE) {
# specify a soil series name
s <- 'magnor'
# return an sf object
x <- seriesExtent(s, type = 'vector')
# return a terra SpatRasters
y <- seriesExtent(s, type = 'raster')
library(terra)
if (!is.null(x) && !is.null(y)) {
x <- terra::vect(x)
# note that CRS are different
terra::crs(x)
terra::crs(y)
# transform vector representation to CRS of raster
x <- terra::project(x, terra::crs(y))
# graphical comparison
par(mar = c(1, 1 , 1, 3))
plot(y, axes = FALSE)
plot(x, add = TRUE)
}
}
Run the code above in your browser using DataLab