Learn R Programming

RGISTools (version 0.9.7)

lsDownload: Search and download Landsat-7 or Landsat-8 images

Description

lsDonwload searches and downloads Landsat-7 or Landsat-8 images concerning a particular location and time interval from the `EarthExplorer' repository. Images are saved as GTiff files in the AppRoot directory.

Usage

lsDownload(satellite, startDate, endDate, username, password, AppRoot,
  lvl = 1, product = c("sr", "source_metadata"), verbose = FALSE,
  untar = TRUE, raw.rm = FALSE, ...)

Arguments

satellite

string containing the type of satellite ("ls7" or "ls8").

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.

username

USGS<U+2019>s `EarthExplorer' username.

password

USGS<U+2019>s `EarthExplorer' password.

AppRoot

the download directory.

lvl

a number specifying the processing level. Default value, 1.

product

character vector with the requested Level-2 products. By default c("sr", "source_metadata").

verbose

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

untar

logical argument. If TRUE, untars downloaded images.

raw.rm

logical argument. If TRUE, removes the raw images.

...

argumetns for nested functions:

Value

this function does not return anything. It saves the imagery as `tar.gz<U+2019> (and GTiff files) in a folder called `raw<U+2019> (`untar<U+2019>) in the AppRoot directory.

Details

lsDonwload is a wrapper function of ls7Search, ls8Search, and lsDownSearch to search and download images in a single step. The function requires USGS's `EarthExplorer' credentials, which can be obtained here.

The files from `EarthExplorer' are compressed as <U+2018>tar.gz<U+2019>. lsDonwload decompresses the images and obtains the corresponding GTiffs. The GTiffs are saved in the AppRoot directory. To change this option, provide AppRoot = <U+201C>full path<U+201D>. When the untarDir argument is defined, the function untars the imagery in this location. Image decompression duplicates the information due to the presence of both, compressed and decompressed images. Set raw.rm = TRUE to remove the former ones.

Examples

Run this code
# NOT RUN {
# load a spatial polygon object of Navarre
data(ex.navarre)

src <- paste0(tempdir(),"/Path_for_downloading_folder")
print(src)
# search and download the images from Landsat-8 between
# 01-01-2018 and 20-01-2018 for the region of Navarre
lsDownload(satellite = "ls8",
           username = "username",
           password = "password",
           startDate = as.Date("01-01-2018", "%d-%m-%Y"),
           endDate = as.Date("20-01-2018", "%d-%m-%Y"),
           extent = ex.navarre,
           AppRoot = src)
           
# remove metadata to free memory space
lsRemoveMetadata()
# }

Run the code above in your browser using DataLab