# NOT RUN {
# load a spatial polygon object of Navarre
data(ex.navarre)
# main output directory
wdir <- file.path(tempdir(),"Path_for_downloading_folder")
print(wdir)
# download MODIS images
modDownSearch(product = "MOD09GA",
startDate = as.Date("01-01-2018", "%d-%m-%Y"),
endDate = as.Date("03-01-2018", "%d-%m-%Y"),
username = "username",
password = "password",
AppRoot = wdir,
extract.tif = TRUE,
collection = 6,
extent = ex.navarre)
# folder with the MODIS images extracted
wdir.mod <- file.path(wdir, "Modis", "MOD09GA")
wdir.mod.tif <- file.path(wdir.mod, "tif")
# mosaic the MODIS images
modMosaic(wdir.mod.tif,
AppRoot = wdir.mod,
out.name = "Navarre",
gutils = TRUE,
overwrite = TRUE,
region = ex.navarre)
# }
Run the code above in your browser using DataLab