Marshalling of 'raster' objects
Usage
# S3 method for class 'RasterLayer'
marshal(x, ...)
# S3 method for class 'RasterLayer'
marshallable(x, ...)
Value
A marshalled
object as described in marshal()
.
Details
raster::writeRaster()
is used to produce a marshalled version
of the original object.
raster::raster()
is used to reconstruct a version of the
original object from the marshalled object.
WARNING - Numerical identical results cannot be guaranteed
Marshalling of RasterLayer
objects is leaky. More precisely,
the method cannot guarantee that multiple rounds of marshalling
and unmarshalling produce numerically identical objects.
For further information, see (1).
References
Issue #311 - 'Incorrect large values saved to disk with writeRaster()', raster GitHub repostory, 2023-05-17, https://github.com/rspatial/raster/issues/311.
Examples
if (requireNamespace("raster", quietly = TRUE)) {
r <- raster::raster(system.file("external/test.grd", package = "raster"))
print(r)
## Marshal
r_ <- marshal(r)
## Unmarshal
r2 <- unmarshal(r_)
print(r2)
}