GetImageryFilesList {spectator}R Documentation

List of downloadable files

Description

List of files that can be downloaded directly (separate files for every spectral band) for the given image.

Usage

GetImageryFilesList(
  id,
  all = FALSE,
  api_key = Sys.getenv("spectator_earth_api_key")
)

Arguments

id

integer indicating the image id (from SearchImages)

all

logical indicating if the auxiliary files should be included. Default: FALSE

api_key

character containing your API key. Default: Sys.getenv("spectator_earth_api_key")

Details

Besides the raw images (jp2 files) as single bands, various auxiliary files are also available. These include image thumbnails, metadata, etc. By default, only the full-sized images are returned by the function. To download the files, all the paths should be prepended with https://api.spectator.earth/imagery/{id}/files/. The raw image files are quite big, if the area of interest is relatively small it might be better to use GetHighResolutionImage.

Value

A data frame with attributes

name

character, name of the file

path

character, path (relative) to download the file

size

integer, size of the file (in bytes)

Source

https://api.spectator.earth/#imagery-files

See Also

SearchImages, GetHighResolutionImage

Examples

 
if(interactive()){
 library(sf)
 my_key <- Sys.getenv("spectator_earth_api_key")
 # get the New York City Central Park shape as area of interest
 dsn <- system.file("extdata", "centralpark.geojson", package = "spectator")
 boundary <- sf::read_sf(dsn, as_tibble = FALSE)
 # search for May 2021 Sentinel 2 images 
 catalog <- SearchImages(aoi = boundary, satellites = "S2", 
     date_from = "2021-05-01", date_to = "2021-05-30", 
     footprint = FALSE, api_key = my_key)
 # get the id of the image with minimal cloud coverage
 best_id <- catalog[order(catalog$cloud_cover_percentage), ][1, "id"]
 # list all downloadable files for the image with minimal cloud coverage
 images <- GetImageryFilesList(best_id, all = FALSE, api_key = my_key)
 }

[Package spectator version 0.2.0 Index]