crsModis
myPointLL = vect(cbind(c(5:6),10:11), crs = crsLL)
getModisTiles(myPointLL)
getModisTiles(myPointLL, getDegreeRaster())
modisUrl = 'https://e4ftl01.cr.usgs.gov/MOTA/MCD12Q1.061/2002.01.01/'
desiredTiles = paste0("(",
paste(getModisTiles(myPointLL, getModisRaster())[,'tile'], collapse='|'),
").*.hdf$")
if(requireNamespace("RCurl", quietly=TRUE) & requireNamespace("XML", quietly=TRUE)) {
allFiles = try(XML::getHTMLLinks(RCurl::getURL(
modisUrl,ftp.use.epsv=FALSE,
dirlistonly = TRUE)), silent=TRUE)
if(!identical(class(allFiles), 'try-error')) {
theFiles = grep(desiredTiles, allFiles, value=TRUE)
paste0(modisUrl, theFiles)
}
}
Run the code above in your browser using DataLab