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

Description Usage Arguments Details Value Examples

View source: R/lsDownSearch.R

Description

lsDownSearch 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
lsDownSearch(
  satellite,
  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").

username

USGS’s ‘EarthExplorer’ username.

password

USGS’s ‘EarthExplorer’ password.

AppRoot

the download directory.

lvl

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

product

a 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:

  • dates a vector with the capturing dates being searched. This argument is mandatory if startDate and endDate are not defined.

  • startDate a Date class object with the starting date of the study period. This argument is mandatory if dates is not defined.

  • endDate a Date class object with the ending date of the study period. This argument is mandatory if dates is not defined.

  • region a Spatial*, projected raster*, or sf* class object defining the area of interest.

  • any argument for ls8Search/ls7Search or lsDownload.

Details

lsDownSearch is a wrapper function of ls7Search, ls8Search, and lsDownload 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 ‘tar.gz’. lsDownSearch decompresses the images and obtains the corresponding GTiffs. The GTiffs are saved in the AppRoot directory. To change this option, provide AppRoot = “full path”. When untar=TRUE, 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.

Value

this function does not return anything. It saves the imagery as 'tar.gz’ (and GTiff files) in a folder called 'raw’ ('untar’) in the AppRoot directory.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
# load a spatial polygon object of Navarre
data(ex.navarre)

wdir <- file.path(tempdir(),"Path_for_downloading_folder")
print(wdir)
# search and download the images from Landsat-8 between
# 01-01-2018 and 20-01-2018 for the region of Navarre
lsDownSearch(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 = wdir)
           
# remove metadata to free memory space
lsRemoveMetadata()

## End(Not run)

RGISTools documentation built on July 2, 2020, 3:58 a.m.