Marshalling of 'terra' objects
# S3 method for class 'SpatVector'
marshal(terra, ...)
# S3 method for class 'SpatVector'
marshallable(...)
A marshalled
object as described in marshal()
.
terra::wrap()
is used to produce a marshalled version
of the original object.
terra::vect()
is used to reconstruct a version of the
original object from the marshalled object.
if (requireNamespace("terra", quietly = TRUE)) {
file <- system.file("ex/lux.shp", package = "terra")
v <- terra::vect(file)
## Marshal SpatVector object
v_ <- marshal(v)
## Unmarshal SpatVector object
v2 <- unmarshal(v_)
stopifnot(all.equal(v2, v, check.attributes = FALSE))
}