json_cube | R Documentation |
Read a data cube from a json description file
json_cube(json, path = NULL)
json |
length-one character vector with a valid json data cube description |
path |
source data cube proxy object |
Data cubes can be stored as JSON description files. These files do not store any data but the recipe how a data cube is constructed, i.e., the chain (or graph) of processes involved.
Since data cube objects (as returned from raster_cube
) cannot be saved with normal R methods,
the combination of as_json
and json_cube
provides a cheap way to save virtual
data cube objects across several R sessions, as in the examples.
data cube proxy object
# create image collection from example Landsat data only
# if not already done in other examples
if (!file.exists(file.path(tempdir(), "L8.db"))) {
L8_files <- list.files(system.file("L8NY18", package = "gdalcubes"),
".TIF", recursive = TRUE, full.names = TRUE)
create_image_collection(L8_files, "L8_L1TP", file.path(tempdir(), "L8.db"), quiet = TRUE)
}
L8.col = image_collection(file.path(tempdir(), "L8.db"))
v = cube_view(extent=list(left=388941.2, right=766552.4,
bottom=4345299, top=4744931, t0="2018-01", t1="2018-12"),
srs="EPSG:32618", nx = 497, ny=526, dt="P1M")
cube = raster_cube(L8.col, v)
# save
fname = tempfile()
as_json(cube, fname)
# load
json_cube(path = fname)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.