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.
Usage
new_dataset_from_auto(x, id = uuid::UUIDgenerate())
Arguments
- x
sf::st_sf()
or a combinedterra::rast()
object.- id
character
unique identifier. Defaults to a random identifier (uuid::UUIDgenerate()
).
Value
A Dataset object.
Details
Create a new Dataset object.
Examples
# find example data
f <- system.file(
"extdata", "projects", "sim_raster", "sim_raster_spatial.tif",
package = "wheretowork"
)
# import data
r <- suppressWarnings(terra::rast(f))
r <- c(r, r * 2, r * 3, r * 4)
names(r) <- c("r1", "r2", "r3", "r4")
# create new dataset
d <- new_dataset_from_auto(r)
# print object
print(d)
#> Dataset
#> paths:
#> spatial: memory
#> attribute: memory
#> boundary: memory