getSentinel_preview retrieves and displays an RGB preview image for a record queried using getSentinel_query. The function is useful to apply visual checks to records before downloading them.

getSentinel_preview(record, on_map = TRUE, show_aoi = TRUE,
  username = NULL, password = NULL, hub = "auto", verbose = TRUE)

Arguments

record

data.frame, single row data.frame collected from the return of getSentinel_query, representing the selected record and all its attributes.

on_map

logical, if TRUE, the preview is displaed corner-georeferenced on a map. If FALSE, a simple RGB plot is displayed. Default is TRUE.

show_aoi

logical, if TRUE, the session AOI defined with set_aoi is drawn to the map viewer. Ignored, if on_map = FALSE or if no AOI has been defined with set_aoi. Default is TRUE.

username

character, a valid user name to the ESA Copernicus Open Access Hub. If NULL (default), the session-wide login credentials are used (see login_CopHub for details on registration).

password

character, the password to the specified user account. If NULL (default) and no seesion-wide password is defined, it is asked interactively ((see login_CopHub for details on registration).

hub

character, either

  • "auto" (default) to automatically select a suitable Copernicus hub depending on the selected platform,

  • "dhus" to look for operational Open Hub records only,

  • "s3" to look for Sentinel-3 pre-operational records only,

  • "s5p" to look for Sentinel-5P precursor pre-operational records only,

  • "GNSS" to look for GNSS RINEX records only,

  • or a valid API URL.

verbose

logical, if TRUE, details on the function's progress will be visibile on the console. Default is TRUE.

Value

None. A plot/view display is generated.

See also

Examples

# NOT RUN {
## Load packages
library(getSpatialData)
library(raster)
library(sf)
library(sp)

## Define an AOI (either matrix, sf or sp object)
data("aoi_data") # example aoi

aoi <- aoi_data[[3]] # AOI as matrix object, or better:
aoi <- aoi_data[[2]] # AOI as sp object, or:
aoi <- aoi_data[[1]] # AOI as sf object

## set AOI for this session
set_aoi(aoi)
view_aoi() #view AOI in viewer
# or, simply call set_aoi() without argument to interactively draw an AOI

## Define time range and platform
time_range <-  c("2017-08-01", "2017-08-30")
platform <- "Sentinel-2"

## set login credentials and an archive directory
# }# NOT RUN {
login_CopHub(username = "username") #asks for password or define 'password'
set_archive("/path/to/archive/")

## Use getSentinel_query to search for data (using the session AOI)
records <- getSentinel_query(time_range = time_range, platform = platform)

## Get an overview of the records
View(records) #get an overview about the search records
colnames(records) #see all available filter attributes
unique(records$processinglevel) #use one of the, e.g. to see available processing levels

## Filter the records
records_filtered <- records[which(records$processinglevel == "Level-1C"),] #filter by Level

## Preview a single record
getSentinel_preview(record = records_filtered[5,])

## Download some datasets
datasets <- getSentinel_data(records = records_filtered[c(4,5,6),])

## Make them ready to use
datasets_prep <- prepSentinel(datasets, format = "tiff")

## Load them to R
r <- stack(datasets_prep[[1]][[1]][1]) #first dataset, first tile, 10m resoultion
# }# NOT RUN {
# }