getTile.Rd 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/getTile.R
  3. \name{getTile}
  4. \alias{getTile}
  5. \title{Get MODIS Tile ID(s)}
  6. \usage{
  7. getTile(x = NULL, tileH = NULL, tileV = NULL)
  8. }
  9. \arguments{
  10. \item{x}{Extent information, see Details. Ignored if \code{tileH} and
  11. \code{tileV} are specified.}
  12. \item{tileH, tileV}{\code{numeric} or \code{character}. Horizontal and
  13. vertical tile number(s) of the
  14. \href{https://nsidc.org/data/docs/daac/mod10_modis_snow/landgrid.html}{MODIS Sinusoidal grid}
  15. (e.g., \code{tileH = 1:5}). If specified, no cropping is performed and the
  16. full tile(s) (if more than one then also mosaicked) is (are) processed!}
  17. }
  18. \value{
  19. A \code{MODISextent} object.
  20. }
  21. \description{
  22. Get MODIS tile ID(s) for a specific geographic area.
  23. }
  24. \details{
  25. If \code{x} is of class (see Examples for use cases)
  26. \tabular{ll}{
  27. \code{missing}:\cr
  28. \tab If 'tileH,tileV' are specified, 'x' will be ignored. If no such tile
  29. indices are provided and 'x' is missing, a viewer window pops up that
  30. allows interactive tile selection from the global MODIS Sinusoidal grid.\cr
  31. \cr
  32. \code{character}:\cr
  33. \tab Either the country name of a \code{map} object (see \code{\link{map}})
  34. or a valid file path of a raster image or ESRI shapefile (shp). The former
  35. approach also supports pattern matching via regular expressions.\cr
  36. \cr
  37. \code{Raster*}:\cr
  38. \tab Spatial extent, resolution, and projection of the specified
  39. \code{Raster*} are determined automatically. This information is used by
  40. \code{\link{runGdal}} to create perfectly matching files. If the
  41. \code{Raster*} comes with no valid CRS,
  42. \href{http://spatialreference.org/ref/epsg/wgs-84/}{EPSG:4326} is assumed.\cr
  43. \cr
  44. \code{Extent}:\cr
  45. \tab Boundary coordinates from \code{Extent} objects are assumed to be in
  46. \href{http://spatialreference.org/ref/epsg/wgs-84/}{EPSG:4326} as well as
  47. such objects have no projection information attached.\cr
  48. \cr
  49. Other:\cr
  50. \tab \code{Spatial}, \code{sf}, or \code{map} object.
  51. }
  52. }
  53. \note{
  54. \strong{MODIS} does no longer support the tile identification and automated
  55. download of MERIS and SRTM data. At least as far as the latter is concerned,
  56. easy data access is granted through \code{\link{getData}}.
  57. }
  58. \examples{
  59. \dontrun{
  60. # ex 1 ############
  61. # interactive tile selection
  62. getTile()
  63. # ex 2: Spatial (taken from ?rgdal::readOGR) ############
  64. dsn <- system.file("vectors/Up.tab", package = "rgdal")[1]
  65. Up <- rgdal::readOGR(dsn, "Up")
  66. getTile(Up)
  67. # ex 3: sf ############
  68. library(mapview)
  69. getTile(franconia)
  70. # ex 4: tileH,tileV ############
  71. getTile(tileH = 18:19, tileV = 4)
  72. # ex 5: Raster* with valid CRS ############
  73. rst1 <- raster(xmn = 9.2, xmx = 17.47, ymn = 46.12, ymx = 49.3)
  74. getTile(rst1)
  75. # this also works for projected data
  76. rst3 <- projectExtent(rst1, crs = "+init=epsg:32633")
  77. getTile(rst3)
  78. # ex 6: Raster* without CRS or, alternatively, Extent -> treated as EPSG:4326 ############
  79. mat2 <- matrix(seq(180 * 360), byrow = TRUE, ncol = 360)
  80. rst2 <- raster(mat2)
  81. getTile(rst2)
  82. getTile(extent(rst1))
  83. # ex 7: map names as returned by search4map() ############
  84. getTile("Austria")
  85. getTile(c("Austria", "Germany"))
  86. # or search for specific map name patterns (use with caution):
  87. m1 <- search4map("Per")
  88. getTile(m1)
  89. # or use 'map' objects directly (remember to use map(..., fill = TRUE)):
  90. m2 <- map("state", region = "new jersey", fill = TRUE)
  91. getTile(m2)
  92. }
  93. }
  94. \seealso{
  95. \code{\link{extent}}, \code{\link{map}}, \code{\link{search4map}}.
  96. }
  97. \author{
  98. Matteo Mattiuzzi, Florian Detsch
  99. }