# NOT RUN {
## 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,])
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab