Process MODIS HDF with GDAL

Downloads MODIS grid data from archive (HTTP or local) and processes the files.

  collection = NULL,
  begin = NULL,
  end = NULL,
  extent = NULL,
  tileH = NULL,
  tileV = NULL,
  SDSstring = NULL,
  job = NULL,
  checkIntegrity = TRUE,
  forceDownload = TRUE,
  overwrite = FALSE,
  maskValue = NULL,

character, see getProduct.


character or integer, see getCollection.

begin, end

Date or character. Begin and end date of MODIS time series, see transDate.


Extent information, defaults to 'global'. See getTile.

tileH, tileV

numeric or character. Horizontal and vertical tile number, see getTile.


character, see getSds.


character. Name of the current job for the creation of the output folder. If not specified, it is created in 'PRODUCT.COLLECTION_DATETIME'.


logical, see getHdf.


logical, see getHdf.


logical, defaults to FALSE. Determines whether or not to overwrite existing SDS output files.


numeric. Value to be excluded when resampling (via gdalwarp -srcnodata argument). This allows non-data values, for example water, to be ignored and thus not effect the final data. NOTE: this argument will be ignored if the original SDS has a No Data value defined.


Additional arguments passed to MODISoptions, e.g. 'wait'. Permanent settings for these arguments are temporarily overridden.


rll outProj CRS/ prj4 or EPSG code of output, any format supported by gdal see examples. Default is 'asIn' (no warping). See ?MODISoptions. pixelSize Numeric single value. Output pixel size in target reference system unit. Default is 'asIn'. See ?MODISoptions. resamplingType Character. Default is 'near', can be one of: 'bilinear', 'cubic', 'cubicspline', 'lanczos'. See ?MODISoptions. blockSize integer. Default NULL that means the stripe size is set by GDAL. Basically it is the "-co BLOCKYSIZE=" parameter. See: compression logical. Default is TRUE, compress data with the lossless LZW compression with "predictor=2". See: dataFormat Data output format, see getOption("MODIS_gdalOutDriver") column 'name'. localArcPath Character. See ?MODISoptions. Local path to look for and/or to download MODIS files. outDirPath Character. See ?MODISoptions. Root directory where to write job folder.

runGdal uses numerous MODIS functions under the hood, see the linked functions in 'Arguments' for details and inputs.

If extent is a Raster* object, the output has exactly the same extent, pixel size, and projection. If extent is a sp or sf object, the output has exactly the same extent and projection except for point geometries with length = 1 (ie. a single point) where only the projection is inherited. If tileH and tileV are used (instead of extent) to define the area of interest, and outProj and pixelSize are 'asIn', the result is only converted from multilayer-HDF to dataFormat, default "GeoTiff" (MODISoptions).


A list of the same length as 'product'. Each product slot either holds a sub-list of processed dates which, for each time step, include the corresponding output files as character objects or, if no files could be found for the specified time period, a single NA.


You need to have GDAL installed on your system. On Unix-alkes, install gdal-bin. On Windows, you need to install GDAL through OSGeo4W or FWTools since the standard GDAL does not support HDF4 format.

See Also

getHdf, runMrt.

  • runGdal
# LST in Austria
runGdal( product="MOD11A1", extent="austria", begin="2010001", end="2010005", SDSstring="101")

# LST with interactiv area selection
runGdal( product="MOD11A1", begin="2010001", end="2010005", SDSstring="101")

### outProj examples
# LST of Austria warped to UTM 34N (the three different possibilites to specify "outProj")
# to find am EPSG or prj4 you may use: prj <- make_EPSG() See  
runGdal( job="LSTaustria", product="MOD11A1", extent="Austria", begin="2010001", end="2010005",
         SDSstring="101", outProj="EPSG:32634")

runGdal( job="LSTaustria", product="MOD11A1", extent="Austria", begin="2010001", end="2010005",
         SDSstring="101", outProj="32634")

runGdal( job="LSTaustria", product="MOD11A1", extent="Austria", begin="2010001", end="2010005",
         SDSstring="101", outProj="+proj=utm +zone=34 +ellps=WGS84 +datum=WGS84 +units=m +no_defs")

### resamplingType examples
runGdal( job="LSTaustria", product="MOD11A1", extent="Austria", begin="2010001", end="2010005",
         SDSstring="1", resamplingType="lanczos", outProj="32634", pixelSize=100)

### processing entire tiles and keeping Sinusoidal projection
# This corresponds to a format conversion (eos-hdf04 to Geotiff) and 
# layer extraction (multi-layer to single layer)
runGdal( job="LSTaustria", product="MOD11A1", tileH=18:19,tileV=4, begin="2010001", end="2010005",
         SDSstring="1", outProj="asIn")

# }
# }
Documentation reproduced from package MODIS, version 1.1.7, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.