Learn R Programming

ursa (version 3.9.4)

codec: 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

Value

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.

Examples

Run this code
# NOT RUN {
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))
# }

Run the code above in your browser using DataLab