# NOT RUN {
if(requireNamespace("curl") &
requireNamespace("sf") &
requireNamespace("terra") &
curl::has_internet()) {
# required packages
library(sf)
library(terra)
# 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')
if (!is.null(x) && !is.null(y)) {
# note that CRS are different
sf::st_crs(x)
terra::crs(y)
# transform vector representation to CRS of raster
x <- sf::st_transform(x, terra::crs(y))
# graphical comparison
par(mar = c(1, 1 , 1, 3))
plot(y, axes = FALSE)
# no fill color
plot(x['series'], add = TRUE, col = NA)
}
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab