S2_download: S2_download helper function

View source: R/S2_download.R

S2_downloadR Documentation

S2_download helper function

Description

Simple helper function to download data (granules, images, QI data)

Usage

S2_download(url, destfile, zip = TRUE, skipExisting = "samesize",
  progressBar = TRUE, timeout = 1800, tries = 1, ...)

Arguments

url

character (valid) url to download file from.

destfile

character download destination.

zip

logical if TRUE, the url will be downloaded as zip archive and (automatically) unzipped in the parent directory of 'destfile' (plays any role only when downloading granules).

skipExisting

character should locally existing files be skipped - one of "always", "samesize" (only if remote and local file size matches), "never".

progressBar

should a progress bar be displayed?

timeout

single file download timeout in seconds (0 means no timeout)

tries

how many times try download in case of failures

...

further arguments not implemented directly - see the granule API doc and the image API doc.

Value

logical vector indicating which downloads where successful

Examples

## Not run: 
  # find, download and unzip a full granule
  granules = S2_query_granule(
    utm = '33UXP',
    dateMin = '2016-06-01',
    dateMax = '2016-06-30'
  )
  S2_download(granules$url, granules$date)

  # find and download a bunch of images
  images = S2_query_image(
    utm = '33UXP',
    dateMin = '2016-06-01',
    dateMax = '2016-06-30',
    band = 'B03'
  )
  S2_download(images$url, paste0(images$date, '.', images$format))

  # reproject downloaded images by passing additional API parameter
  S2_download(images$url, paste0(images$date, '.', images$format), srid = 4326)

  # download particular URL
  S2_download(
    'https://test%40s2%2Eboku%2Eeodc%2Eeu:test@s2.boku.eodc.eu/image/33148479',
    'test.jp2'
  )

## End(Not run)

IVFL-BOKU/sentinel2 documentation built on May 13, 2022, 11:15 p.m.