# NOT RUN {
# load a spatial polygon object of Navarre
data(ex.navarre)
# download S2MSI1C products sensed by Sentinel-2
# in July-August 2018
sres <- 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(sres)
sres.sen.R094 <- sres[grepl("R094", names(sres))]
names(sres.sen.R094)
# list the dates in sres
senGetDates(names(sres.sen.R094),format="%Y%j")
wdir <- file.path(tempdir(),"Path_for_downloading_folder")
# donwload the imagery
senDownload(searchres = sres.sen.R094,
username = "username",
password = "password",
AppRoot = wdir,
unzip = TRUE)
wdir.sen.unzip <- file.path(wdir,"Sentinel","unzip")
files.sen.unzip<-list.files(wdir.sen.unzip,
pattern = "\\TCI.jp2$",
full.names = TRUE,
recursive = TRUE)
img.sen.rgb<-stack(files.sen.unzip[1])
plotRGB(img.sen.rgb)
# }
Run the code above in your browser using DataLab