MODIS (version 1.0.0)

getTile: Get MODIS Tile ID(s)

Description

Get MODIS, MERIS, or SRTM tile ID(s) for a specific geographic area.

Usage

getTile(extent = NULL, tileH = NULL, tileV = NULL, buffer = NULL,
  system = "MODIS", zoom = TRUE)

Arguments

extent

Extent information, see Details.

tileH, tileV

numeric or character. Horizontal and vertical tile number(s) (e.g., tileH = 1:5), see https://nsidc.org/data/docs/daac/mod10_modis_snow/landgrid.html. Ignored if 'extent' is specified.

buffer

numeric (in map units). Buffers the specified 'extent', negative values are allowed. If 'extent' is a vector object (Spatial* or character name of a map object), only one value is allowed (e.g., buffer = 0.5) and gBuffer is used. In all other cases, also buffer = c(x, y) can be specified.

system

character, defaults to "MODIS". Available alternatives are "MERIS" and "SRTM" (see Note).

zoom

logical, defaults to TRUE. The interactive mode is only activated if no other spatial extent (i.e., 'extent', 'tileH', 'tileV') is specified. If zoom = TRUE, the first two clicks on the map are defining the zoom-in area, and the next two clicks are the download area. For large areas you can set zoom = FALSE.

Value

A MODISextent object.

Details

ll extent:

If list: Then LatLon coordinates in the following form: list(xmin = numeric, xmax = numeric, ymax = numeric, ymin = numeric).

If character: The country name of a map object (see map), you can use search4map to find a map by regular expression. Or the file name (plus path) of a raster image or ESRI shapefile (shp).

Other: If Raster*. Using a Raster* object as extent, the function automatically determines the extent, resolution, and projection. This will be used by runGdal creating perfectly matching files. If the raster file has not a valid CRS string, LatLon is assumed. Using an extent object, it must be in LatLon, as the extent object has no projection information attached. If ESRI shapefile (shp) or map object, a call to over is performed to determine the MODIS tile containg the extent. This often considerably reduces the number of required tiles, but can lead to NO-DATA areas if not all tiles had to be downloaded in the bounding box of 'extent'!

PS: If an extent is specified through tileV, tileH arguments, no cropping is performed and the full un-cutted tile(s) (if more than one then also mosaicked) is/are processed!

See Also

extent, map, search4map.

Examples

Run this code

# ex 1 ############
# drawing the extent. NOTE: It is not possible to draw a date-line crossing area!
# draw extent with zoom, for smaller extents
getTile()

# ex 2 ############
# 'extent' specified with a 'Spatial*' object (taken from ?rgdal::readOGR)
dsn <- system.file("vectors/Up.tab", package = "rgdal")[1]
Up <- rgdal::readOGR(dsn, "Up")
getTile(extent = Up)

# ex 3 ############
# with 'tileH' and 'tileV'
getTile(tileH = 18:19, tileV = 4)

# ex 4 ############
# with 'extent' of class 'list'
Austria <- list(ymin = 46.12, ymax = 49.3, xmin = 9.2, xmax = 17.47)
getTile(extent = Austria)
getTile(extent = Austria, buffer = 10)
getTile(extent = Austria, buffer = c(0, 10))  # x, y

# ex 5 ############
# with 'extent' or 'Raster*' object from "raster" package
rasterObject <- raster(xmn = 9.2, xmx = 17.47, ymn = 46.12, ymx = 49.3, 
                       crs = "+init=epsg:4326")
getTile(extent = rasterObject)
getTile(extent = extent(rasterObject))

# also works for projected data
rasterObject2 <- projectExtent(rasterObject, crs = "+init=epsg:32633")
getTile(extent = rasterObject2)

# ex 6 #################
# Character name of a map contained in map("worldHires", plot = FALSE)$names
getTile(extent = "Austria")
getTile(extent = c("Austria", "Germany"))

# Search for specific map name patterns (use with caution):
m1 <- search4map("Per")
getTile(extent = m2)

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

# SRTM and MERIS data
getTile(extent = c("austria", "germany", "switzerland"), system = "SRTM")
getTile(extent = c("austria", "germany", "switzerland"), system = "MERIS")


Run the code above in your browser using DataLab