getMODIS_query queries USGS Earth Explorer for MODIS data by some basic input search parameters. The function returns a data frame that can be further filtered.

getMODIS_query(time_range, name = "all", aoi = NULL, username = NULL,
  password = NULL, verbose = TRUE)

Arguments

time_range

character, containing two elements: the query's starting date and stopping date, formatted "YYYY-MM-DD", e.g. "2017-05-15"

name

character, optional. Identifies the name of the product to be queried. If set to "all" (default), every available MODIS product is searched for results and included in the output. Use getMODIS_names to revcieve a vector with all available MODIS products from Earth Explorer, if you want to select a specific one.

aoi

sfc_POLYGON or SpatialPolygons or matrix, representing a single multi-point (at least three points) polygon of your area-of-interest (AOI). If it is a matrix, it has to have two columns (longitude and latitude) and at least three rows (each row representing one corner coordinate). If its projection is not +proj=longlat +datum=WGS84 +no_defs, it is reprojected to the latter. Use set_aoi instead to once define an AOI globally for all queries within the running session. If aoi is undefined, the AOI that has been set using set_aoi is used.

username

character, a valid user name to the USGS EROS Registration System (ERS). If NULL (default), the session-wide login credentials are used (see login_USGS for details on registration).

password

character, the password to the specified user account. If NULL (default) and no seesion-wide password is defined, it is asked interactively ((see login_USGS for details on registration).

verbose

logical, if TRUE, details on the function's progress will be visibile on the console. Default is TRUE.

Value

A data frame of records. Each row represents one record. The data frame can be further filtered by its columnwise attributes. The selected rows can be handed over to the other getMODIS functions for previewing or downloading.

See also

Examples

## Load packages library(getSpatialData) library(sf) ## set aoi and time range for the query set_aoi(aoi_data[[1]]) time_range <- c("2017-08-01", "2017-08-30") ## Login to USGS ERS
# NOT RUN { login_USGS("username") ## set archive directory set_archive("/path/to/archive/") ## get available products and select one product_names <- getMODIS_names() product <- grep("MOD13Q1", product_names, value = T) ## query for records for your AOI, time range and product query <- getMODIS_query(time_range = time_range, name = product) ## preview a record getMODIS_preview(query[1,]) ## download records 1 and 2 files <- getMODIS_data(query[1:2,]) # }