marshal.terra: Marshalling of 'terra' objects

marshal.SpatVectorR Documentation

Marshalling of 'terra' objects

Description

Marshalling of 'terra' objects

Usage

## S3 method for class 'SpatVector'
marshal(terra, ...)

## S3 method for class 'SpatVector'
marshallable(...)

Arguments

terra

An terra::SpatVector.

...

Not used.

Details

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.

Value

A marshalled object as described in marshal().

Examples

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))
}


HenrikBengtsson/marshal documentation built on June 11, 2024, 11:35 a.m.