From 1b3ce074fac9a80217d20d427a71cbc915fbb1b3 Mon Sep 17 00:00:00 2001 From: Michael Mahoney Date: Sat, 6 Jan 2024 20:08:35 -0500 Subject: [PATCH] Robustify planetary computer check (#24) --- R/get_stac_data.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/get_stac_data.R b/R/get_stac_data.R index 9a04da2..c0f27ea 100644 --- a/R/get_stac_data.R +++ b/R/get_stac_data.R @@ -242,7 +242,7 @@ get_stac_data <- function(aoi, gdalwarp_options = character() ) - if (is.null(sign_function) && stac_source == "https://planetarycomputer.microsoft.com/api/stac/v1") { + if (is.null(sign_function) && is_pc(stac_source)) { sign_function <- sign_planetary_computer } @@ -962,3 +962,7 @@ figure_out_progress_length <- function(items_urls, mask_band, composite_function } length_progress } + +is_pc <- function(url) { + grepl("planetarycomputer.microsoft.com/api/stac/v1", url) +}