Open mdsumner opened 5 months ago
## get a token sas_base <- function() { "https://planetarycomputer.microsoft.com/api/sas/v1/token" } sas_account_container <- function(account, container = NULL) { file.path(sas_base(), account, container) } sas_collectionid <- function(collection_id) { file.path(sas_base(), collection_id) } sas <- function(id) { if (grepl("/", id)) { uri <- sas_account_container(id) } else { uri <- sas_collectionid(id) } #{collection_id} #{storage_account}/{container} readLines(uri, warn = FALSE) } pc_sas_token <- function(id) { x <- sas(id) jsonlite::fromJSON(x)$token } pcstacitem <- function(item, asset) { glue::glue("/vsicurl/https://pcstacitems.blob.core.windows.net/items/{asset}?{pc_sas_token(item)}") } pcstacitem("io-lulc-9-class", "io-lulc-9-class.parquet")