modMosaic: Mosaic a set of MODIS images

Description Usage Arguments Details Examples

View source: R/modMosaic.R

Description

modMosaic merges the MODIS imagery that covers a region of interest on the same dates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
modMosaic(
  src,
  AppRoot,
  region = NULL,
  out.name = "outfile",
  verbose = FALSE,
  gutils = TRUE,
  overwrite = FALSE,
  ...
)

Arguments

src

the path of the folder with the MODIS images in GTiff format.

AppRoot

the directory where the mosaicked images are saved.

region

a Spatial*, projected raster*, or sf class object defining the area of interest.

out.name

the name of the folder that stores the outputs. By default, “outfile” is assigned.

verbose

logical argument. If TRUE, the function prints the running steps and warnings.

gutils

logical argument. If TRUE, the function uses ‘GDAL’ utilities for mosaicking.

overwrite

logical argument. If TRUE, overwrites the existing images with the same name.

...

arguments for nested functions:

  • pathrow a vector of character with the path and row numbers of the tiles concerning the region of interest in 'hXXvYY' format. This argument is mandatory if region is not provided.

  • bFilter a vector with the bands to be mosaicked. If not supplied, all bands are mosaicked.

  • dates a vector with the capturing dates being considered for mosaicking. If not supplied, all dates are mosaicked.

Details

The function mosaics the imagery in the src folder. The folder can hold GTiff images from several tiles, dates and bands. When only a subset dates has to be mosaicked, the dates should be provided through the argument dates. The dates must be provided as a Date class objects. For further details about the bFilter argument, go to the modDownload function. Once mosaicked, the images can be cropped to fit the region (optional). The region can be defined in any coordinate reference system, since modMosaic automatically reproject the extent to match the projection of the image. The outputs will be placed in the AppRoot directory, under the folder named as out.name. If no name is provided, the folder is named “outfile”.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
# load a spatial polygon object of Navarre
data(ex.navarre)
# main output directory
wdir <- file.path(tempdir(),"Path_for_downloading_folder")
print(wdir)
# download MODIS images
modDownSearch(product = "MOD09GA",
              startDate = as.Date("01-01-2018", "%d-%m-%Y"),
              endDate = as.Date("03-01-2018", "%d-%m-%Y"),
              username = "username",
              password = "password",
              AppRoot = wdir,
              extract.tif = TRUE,
              collection = 6,
              extent = ex.navarre)
# folder with the MODIS images extracted 
wdir.mod <- file.path(wdir, "Modis", "MOD09GA")
wdir.mod.tif <- file.path(wdir.mod, "tif")
# mosaic the MODIS images
modMosaic(wdir.mod.tif,
          AppRoot = wdir.mod,
          out.name = "Navarre",
          gutils = TRUE,
          overwrite = TRUE,
          region = ex.navarre)

## End(Not run)

RGISTools documentation built on July 2, 2020, 3:58 a.m.