getTile: Get MODIS Tile ID(s)

getTileR Documentation

Get MODIS Tile ID(s)

Description

Get MODIS tile ID(s) for a specific geographic area.

Usage

## S4 method for signature 'missing,missing,missing'
getTile(mode = c("click", "draw"), ...)

## S4 method for signature 'missing,charORnum,charORnum'
getTile(x, tileH, tileV, ...)

## S4 method for signature 'character,ANY,ANY'
getTile(x, tileH, tileV, ...)

## S4 method for signature 'Raster,ANY,ANY'
getTile(x, tileH, tileV, ...)

## S4 method for signature 'map,ANY,ANY'
getTile(x, tileH, tileV, ...)

## S4 method for signature 'Extent,ANY,ANY'
getTile(x, tileH, tileV, ...)

## S4 method for signature 'bbox,ANY,ANY'
getTile(x, tileH, tileV, ...)

## S4 method for signature 'Spatial,ANY,ANY'
getTile(x, tileH, tileV, ...)

## S4 method for signature 'sf,ANY,ANY'
getTile(x, tileH, tileV, ...)

## S4 method for signature 'sfc,ANY,ANY'
getTile(x, tileH, tileV, ...)

Arguments

mode

Interactive selection mode as character. Available options are "click" (default) and "draw" that trigger interactive MODIS tile selection and free feature drawing, respectively. Triggered only if 'x' and tile IDs are omitted.

...

Additional arguments passed to MODISoptions(), see Details.

x

Extent information, see Details.

tileH, tileV

numeric or character. Horizontal and vertical tile number(s) of the MODIS Sinusoidal grid (e.g., tileH = 1:5). Cropping is disabled here and full tiles (if more than one then also mosaicked) are processed instead. Ignored if 'x' is specified.

Details

Unless stated otherwise in the following, target 'outProj' and 'pixelSize' are carried over from MODISoptions().

If 'x' is of class (see Examples for use cases)

missing:
If tile IDs (see Arguments) are also missing, a viewer window pops up that allows for interactive tile selection from the global MODIS Sinusoidal grid or, if mode = "draw", free feature drawing.
character:
The country name of a map object (see maps::map()) with pattern matching via regular expressions enabled. Alternatively, a valid file path to a single ESRI shapefile (.shp) or an image readable by raster::raster().
Raster*:
Spatial extent, resolution, and projection of the specified Raster* are determined automatically. This information is used by runGdal() to create perfectly matching files. If the Raster* comes with no valid CRS, EPSG:4326 is assumed.
Extent, bbox:
Boundary coordinates from Extent objects are generally assumed to be in EPSG:4326 as such objects have no projection information attached. The same applies for bbox objects lacking CRS information.
sf, sfc, Spatial:
Except for resolution, same as for Raster*.
Other:
A map object.

Value

A MODISextent object.

Note

MODIS does no longer support the tile identification and automated download of MERIS and SRTM data. At least as far as the latter is concerned, easy data access is granted through raster::getData().

Author(s)

Matteo Mattiuzzi, Florian Detsch

See Also

raster::extent(), sf::st_bbox(), maps::map(), search4map().

Examples

## Not run: 
# ex 1 ############
# interactive tile selection
getTile()
getTile(mode = "draw")

## End(Not run)

# ex 2: Spatial ############
dsn <- system.file("ex/lux.shp", package = "terra")
Up <- raster::shapefile(dsn, "Up")
getTile(Up)

# ex 3: sf ############
ifl <- system.file("shape/nc.shp", package = "sf")
nc <- sf::st_read(ifl, quiet = TRUE)
getTile(nc)

# ex 4: tileH,tileV ############
getTile(tileH = 18:19, tileV = 4)

# ex 5: Raster* with valid CRS ############
rst1 <- raster(xmn = 9.2, xmx = 17.47, ymn = 46.12, ymx = 49.3)
getTile(rst1)

# this also works for projected data
rst3 <- projectExtent(rst1, crs = "+init=epsg:32633")
getTile(rst3)

# ex 6: Raster* without CRS or, alternatively, Extent or bbox --> treated as EPSG:4326 ############
mat2 <- matrix(seq(180 * 360), byrow = TRUE, ncol = 360)
rst2 <- raster(mat2, xmn = -180, xmx = 180, ymn = -90, ymx = 90)
getTile(rst2)
getTile(extent(rst1))
getTile(sf::st_bbox(nc))

# ex 7: map names as returned by search4map() ############
getTile("Austria")
getTile(c("Austria", "Germany"))

# or search for specific map name patterns (use with caution):
m1 <- search4map("Per")
getTile(m1)

# or use 'map' objects directly (remember to use map(..., fill = TRUE)): 
m2 <- map("state", region = "new jersey", fill = TRUE)
getTile(m2)


MatMatt/MODIS documentation built on Feb. 1, 2023, 12:39 a.m.