Learn R Programming

RGISTools (version 0.9.7)

senDownload: Search and download Sentinel images

Description

senDownload searches and downloads Sentinel images concerning a particular location and time interval from `SciHub's' repository.

Usage

senDownload(username, password, AppRoot, verbose = FALSE, ...)

Arguments

username

ESA<U+2019>s `SciHub' username.

password

ESA<U+2019>s `SciHub' password.

AppRoot

the directory where the images are saved.

verbose

logical argument. If TRUE, the function prints the running steps and warnings.

...

arguments for nested functions:

  • product the type of Sentinel product. Ex. "S2MSI1C", "S2MSI2A", "S2MSI2Ap", ...

  • startDate a Date class object with the starting date of the study period.

  • endDate a Date class object with the ending date of the study period.

  • extent an extent, Raster*, or Spatial* object representing the region of interest with longitude/latitude coordinates.

  • platform the name of the Sentinel mission ("Sentinel-1", "Sentinel-2", ...).

  • nattempts the number of attempts to download an image in case it becomes corrupted.

  • unzip logical argument. If TRUE, unzips the images.

  • verbose logical argument. If TRUE, the function prints the running steps and warnings.

Details

senDonwload is a wrapper function of senSearch and senDownSearch to search and download images in a single step. The function requires ESA<U+2019>s `SciHub' credentials, which can be obtained here.

Examples

Run this code
# NOT RUN {
# load a spatial polygon object of Navarre
data(ex.navarre)
# Download S2MSI1C products sensed by Sentinel-2 
# between the julian dates 210 and 218, 2018
src <- paste0(tempdir(),"/Path_for_downloading_folder")
print(src)
senDownload(startDate = as.Date("2018210", "%Y%j"),
            endDate = as.Date("2018218", "%Y%j"),
            platform = "Sentinel-2",
            extent = ex.navarre,
            product = "S2MSI1C",
            pathrow = c("R094"),
            username = "username",
            password = "password",
            AppRoot = src)
            
src.sen <- file.path(src, "Sentinel-2")
src.sen.unzip <- file.path(src.sen, "unzip")
                  
files <- list.files(src.unzip,
                    pattern = "\\TCI.jp2$",
                    full.names = TRUE,
                    recursive = TRUE)
rgb <- stack(files[1])
plotRGB(rgb)
# }

Run the code above in your browser using DataLab