Learn R Programming

mapmisc (version 2.1.0)

modis: MODIS tiles and projection

Description

Raster containing MODIS tile ID's

Usage

getModisTiles(x, tiles)
crsModis
getModisRaster()
getDegreeRaster()

Value

getModisTiles returns a matrix with modis tiles.

getModisRaster shows horizontal and vertical tile names for downloading data from MODIS.

getDegreeRaster shows horizontal and vertical tiles in long-lat, for downloading elevation.

Arguments

x

A spatial object which modis tiles will cover.

tiles

A raster with modis (or other) tiles.

Details

Provides information on tiles which can be downloaded from MODIS.

References

https://modis-land.gsfc.nasa.gov/MODLAND_grid.html, https://spatialreference.org/ref/esri/54008/

Examples

Run this code

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