codec {ursa}R Documentation

Reduce and restore dimenstions for sparse data matrix

Description

compress reduces dimension of source image matrix and assigns indices. decompress uses indices for expansion of reduced image matrix.

Usage

decompress(obj)
compress(obj)

Arguments

obj

Object of class ursaRaster

Details

After masking, vectorization of lines, points and small polygons image matrix is often sparse. Compressing (compress) is an option to reduce object size in memory. Decompressing (decompress) restore original data matrix.

Value

Object of class ursaRaster

Note

Currently, usage of compressed image matrix is limited. Spatial filtering (e.g. focal_mean) does not operate with compressed data.

Author(s)

Nikita Platonov platonov@sevin.ru

Examples

session_grid(NULL)
b <- as.data.frame(pixelsize())
b <- subset(b,x>1000000 & x<2000000 & y>3000000 & y<4000000)
a1 <- as.ursa(b)
print(a1)
print(object.size(a1))
a2 <- compress(a1)
print(a2)
print(object.size(a2))
a3 <- decompress(a2)
print(a3)
print(object.size(a3))
print(identical(a1,a3))

[Package ursa version 3.10.4 Index]