Process MODIS HDF with GDAL

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

runGdal(product, collection = NULL, begin = NULL, end = NULL,
  extent = NULL, tileH = NULL, tileV = NULL, buffer = 0,
  SDSstring = NULL, job = NULL, checkIntegrity = TRUE, wait = 0.5,
  forceDownload = TRUE, overwrite = FALSE, ...)

character, see getProduct.


character or integer, see getCollection.


character. Begin date of MODIS time series, see transDate for formatting.


Same for end date.


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


numeric or character. Horizontal tile number, see getTile.


numeric or character. Vertical tile number(s), see tileH.


numeric (in map units), 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.


numeric, see getHdf.


logical, see getHdf.


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


Additional arguments passed to MODIS:::combineOptions(), see also MODISoptions.


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 a lot of MODIS package functions, see in section Arguments and Methods the respective '?function' 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 object (i.e., polygon shapefile), the output has exactly the same extent and projection. 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 holds a sub-list of processed dates which, for each time step, include the corresponding output files as character objects.


You need to have a GDAL installed on your system! On Unix-alkes, install 'gdal-bin' (i.e. Ubuntu: 'sudo apt-get 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.0.0, License: GPL (>= 3) | file LICENSE

Community examples

Looks like there are no examples yet.