Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/batch_gdal_translate.R
Runs gdal_translate on a batch of files
1 2 3 4 5 6 7 8 9 |
infiles |
Character. A directory or a character vector of files (including their path). If a directory, all files matching the pattern will be converted. |
outdir |
Character. Output directory to save the output files. |
outsuffix |
Character. The suffix to append to the input filename (minus its extension) to generate the output filename(s). |
pattern |
Character. If infiles is a directory, this is used to limit the file it is searching for. |
recursive |
Logical. If infiles is a directory, should files be searched for recursively? |
verbose |
Logical. Enable verbose execution? Default is FALSE. |
... |
Parameters to pass to |
This function is designed to run gdal_translate in batch mode. Files are passed to the function either directly as a character vector of filenames, or by passing it a directory and (typically) a search pattern (e.g. pattern=".tif"). gdal_translate will execute based on parameters passed to it, and the output file will be named based on the input file (stripped of its extension), with the outsuffix appended to it.
If a parallel engine is started and registered with foreach, this program will run in parallel (one gdal_translate per worker).
Either a list of NULLs or a list of RasterBricks depending on whether output_Raster is set to TRUE.
Jonathan A. Greenberg (gdalUtils@estarcion.net)
http://www.gdal.org/gdal_translate.html
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
input_folder <- system.file("external",package="gdalUtils")
list.files(input_folder,pattern=".tif")
output_folder <- tempdir()
# library(spatial.tools)
# sfQuickInit() # from package spatial.tools to launch a parallel PSOCK cluster
batch_gdal_translate(infiles=input_folder,outdir=output_folder,
outsuffix="_converted.envi",of="ENVI",pattern=".tif$")
list.files(output_folder,pattern="_converted.envi$")
# sfQuickStop() # from package spatial.tools to stop a parallel PSOCK cluster
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.