Learn R Programming

RGISTools (version 1.0.2)

lsPreview: Preview Landsat-7 or Landsat-8 satellite images

Description

lsPreview shows a preview of the n-th image from a set of search results on an interactive map.

Usage

lsPreview(
  searchres,
  n,
  dates,
  lpos = c(3, 2, 1),
  add.Layer = FALSE,
  verbose = FALSE,
  ...
)

Arguments

searchres

a data.frame with the results from ls7Search or ls8Search.

n

a numeric argument identifying the location of the image in searchres.

dates

a vector of Dates being considered for previewing. This argument is mandatory if n is not defined.

lpos

vector argument. Defines the position of the red-green-blue layers to enable false color visualization.

add.Layer

logical argument. If TRUE, the function plots the image on an existing map. Allows combinations of images on a map using senPreview and modPreview functions.

verbose

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

...

arguments for nested functions:

  • arguments allowed by the viewRGB function from the mapview packages are valid arguments.

Value

this function does not return anything. It displays a preview of one of the search results.

Details

The function shows a preview of the n-th output image from a search in the Landsat archives (ls7Search or ls8Search, with browseAvailable = "Y"). The preview is downloaded from USGS Bulk Metadata Service. Please, be aware that only some images may have a preview.

Examples

Run this code
# NOT RUN {
# load a spatial polygon object of Navarre
data(ex.navarre)
wdir <- file.path(tempdir(),"Path_for_downloading_folder")
# retrieve jpg images covering Navarre between 2011 and 2013
sres <- ls7Search(startDate = as.Date("01-01-2011", "%d-%m-%Y"),
                  endDate = as.Date("31-12-2013", "%d-%m-%Y"),
                  extent = ex.navarre,
                  precise = TRUE,
                  browseAvaliable = "Y",
                  AppRoot = wdir)
lsPreview(sres, 1)
# filter the images with less than 1% pixels covered by clouds
sres.cloud.free = subset(sres, sres$cloudCover < 1)
lsPreview(sres.cloud.free, 1)
lsPreview(sres.cloud.free, 2,add.Layer = TRUE)
# plot all the images in one date
lsPreview(sres.cloud.free,dates=as.Date("2013-09-04"))
# }

Run the code above in your browser using DataLab