Get MODIS tile ID(s) for a specific geographic area.
getTile(x = NULL, tileH = NULL, tileV = NULL)
Extent information, see Details. Ignored if tileH
and
tileV
are specified.
numeric
or character
. Horizontal and
vertical tile number(s) of the
MODIS Sinusoidal grid
(e.g., tileH = 1:5
). If specified, no cropping is performed and the
full tile(s) (if more than one then also mosaicked) is (are) processed!
A MODISextent
object.
If x
is of class (see Examples for use cases)
missing : |
|
If 'tileH,tileV' are specified, 'x' will be ignored. If no such tile indices are provided and 'x' is missing, a viewer window pops up that allows interactive tile selection from the global MODIS Sinusoidal grid. | |
character : |
|
Either the country name of a map object (see map )
or a valid file path of a raster image or ESRI shapefile (shp). The former
approach also supports pattern matching via regular expressions. |
|
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 : |
|
Boundary coordinates from Extent objects are assumed to be in
EPSG:4326 as well as
such objects have no projection information attached. |
|
Other: |
missing : |
extent
, map
, search4map
.
# NOT RUN {
# ex 1 ############
# interactive tile selection
getTile()
# ex 2: Spatial (taken from ?rgdal::readOGR) ############
dsn <- system.file("vectors/Up.tab", package = "rgdal")[1]
Up <- rgdal::readOGR(dsn, "Up")
getTile(Up)
# ex 3: sf ############
library(mapview)
getTile(franconia)
# 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 -> treated as EPSG:4326 ############
mat2 <- matrix(seq(180 * 360), byrow = TRUE, ncol = 360)
rst2 <- raster(mat2)
getTile(rst2)
getTile(extent(rst1))
# 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)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab