# NOT RUN {
# load a spatial polygon object of Navarre
data(ex.navarre)
# download S2MSI1C products sensed by Sentinel-2
# in July-August 2018
searchres <- senSearch(startDate = as.Date("2018-07-29","%Y-%m-%d"),
endDate = as.Date("2018-08-06","%Y-%m-%d"),
platform = "Sentinel-2",
extent = ex.navarre,
product = "S2MSI1C",
username = "username",
password = "password")
# filtering the path R094 where Navarre is located
names(searchres)
searchres.R094 <- searchres[grepl("R094", names(searchres))]
names(searchres.R094)
# list the dates in searchres
senGetDates(names(searchres.R094),format="%Y%j")
src <- paste0(tempdir(),"/Path_for_downloading_folder")
# donwload the imagery
senDownSearch(searchres = searchres.R094,
username = "username",
password = "password",
AppRoot = src,
unzip = TRUE)
src.unzip <- file.path(src,"unzip")
files<-list.files(src.unzip,
pattern = "\\TCI.jp2$",
full.names = TRUE,
recursive = TRUE)
rgb<-stack(files[1])
plotRGB(rgb)
# }
Run the code above in your browser using DataLab