diff --git a/R/get_stac_data.R b/R/get_stac_data.R index 58611cc..7890212 100644 --- a/R/get_stac_data.R +++ b/R/get_stac_data.R @@ -172,14 +172,16 @@ #' mask_band = "qa_pixel", #' mask_function = landsat_mask_function, #' item_filter_function = landsat_platform_filter, -#' platforms = c("landsat-9", "landsat-8") +#' platforms = c("landsat-9", "landsat-8"), +#' output_filename = tempfile(fileext = ".tif") #' ) #' #' # or, mostly equivalently (will download more bands): #' landsat_image <- get_landsat_imagery( #' aoi, #' start_date = "2022-06-01", -#' end_date = "2022-08-30" +#' end_date = "2022-08-30", +#' output_filename = tempfile(fileext = ".tif") #' ) #' #' # The `get_*_imagery()` functions will download @@ -188,7 +190,8 @@ #' sentinel1_data <- get_sentinel1_imagery( #' aoi, #' start_date = "2022-06-01", -#' end_date = "2022-07-01" +#' end_date = "2022-07-01", +#' output_filename = tempfile(fileext = ".tif") #' ) #' names(terra::rast(sentinel1_data)) #' @@ -207,7 +210,8 @@ #' aoi, #' start_date = "2022-06-01", #' end_date = "2022-07-01", -#' asset_names = sentinel2_band_mapping$planetary_computer_v1["B01"] +#' asset_names = sentinel2_band_mapping$planetary_computer_v1["B01"], +#' output_filename = tempfile(fileext = ".tif") #' ) #' names(terra::rast(sentinel2_imagery)) #' diff --git a/man/get_stac_data.Rd b/man/get_stac_data.Rd index 9e9f34f..70bbaa3 100644 --- a/man/get_stac_data.Rd +++ b/man/get_stac_data.Rd @@ -384,14 +384,47 @@ get_stac_data(aoi, mask_band = "qa_pixel", mask_function = landsat_mask_function, item_filter_function = landsat_platform_filter, - platforms = c("landsat-9", "landsat-8") + platforms = c("landsat-9", "landsat-8"), + output_filename = tempfile(fileext = ".tif") ) # or, mostly equivalently (will download more bands): landsat_image <- get_landsat_imagery( aoi, start_date = "2022-06-01", - end_date = "2022-08-30" + end_date = "2022-08-30", + output_filename = tempfile(fileext = ".tif") +) + +# The `get_*_imagery()` functions will download +# all available "data" assets by default +# (usually including measured values, and excluding derived bands) +sentinel1_data <- get_sentinel1_imagery( + aoi, + start_date = "2022-06-01", + end_date = "2022-07-01", + output_filename = tempfile(fileext = ".tif") +) +names(terra::rast(sentinel1_data)) + +# You can see what bands will be downloaded by a function +# by inspecting the corresponding `band_mapping` object: +sentinel2_band_mapping$planetary_computer_v1 + +# And you can add additional assets using `c()`: +c( + sentinel2_band_mapping$planetary_computer_v1, + "scl" +) + +# Or subset the assets downloaded using `[` or `[[`: +sentinel2_imagery <- get_sentinel2_imagery( + aoi, + start_date = "2022-06-01", + end_date = "2022-07-01", + asset_names = sentinel2_band_mapping$planetary_computer_v1["B01"], + output_filename = tempfile(fileext = ".tif") ) +names(terra::rast(sentinel2_imagery)) \dontshow{\}) # examplesIf} }