Create a new Dataset object by automatically calculating all metadata from the underlying data. This function is useful when pre-calculated metadata are not available. Note this function will take longer to create variables than other functions because it requires performing geospatial operations.
new_dataset_from_auto(x, skip_bm = FALSE, id = uuid::UUIDgenerate())
x |
|
---|---|
skip_bm |
|
id |
|
A Dataset object.
Create a new Dataset object.
For spatial uploads (shapefile) with many planning units, building
boundary data can result in a std::bad_alloc error. To avoid this, the
user can skip generating a boundary matrix by setting skip_bm = TRUE
.
# find example data
f <- system.file(
"extdata", "projects", "sim_raster", "sim_raster_spatial.tif",
package = "wheretowork"
)
# import data
r <- suppressWarnings(raster::raster(f))
r <- raster::stack(r, r * 2, r * 3, r * 4)
# create new dataset
d <- new_dataset_from_auto(r)
# print object
print(d)
#> Dataset
#> paths:
#> spatial: memory
#> attribute: memory
#> boundary: memory