# NOT RUN {
# This builds a gdal_translate command.
executable <- "gdal_translate"
parameter_variables <- list(
logical = list(
varnames <- c("strict","unscale","epo",
"eco","q","sds","stats")),
vector = list(
varnames <- c("outsize","scale","srcwin",
"projwin","a_ullr","gcp")),
scalar = list(
varnames <- c("a_nodata")),
character = list(
varnames <- c("ot","of","mask","expand","a_srs",
"src_dataset","dst_dataset")),
repeatable = list(
varnames <- c("b","mo","co")))
parameter_order <- c(
"strict","unscale","epo","eco","q","sds","stats",
"outsize","scale","srcwin","projwin","a_ullr","gcp",
"a_nodata",
"ot","of","mask","expand","a_srs",
"b","mo","co",
"src_dataset","dst_dataset")
parameter_noflags <- c("src_dataset","dst_dataset")
# Now assign some parameters:
parameter_values = list(
src_dataset = "input.tif",
dst_dataset = "output.envi",
of = "ENVI",
strict = TRUE
)
cmd <- gdal_cmd_builder(
executable=executable,
parameter_variables=parameter_variables,
parameter_values=parameter_values,
parameter_order=parameter_order,
parameter_noflags=parameter_noflags)
cmd
system(cmd,intern=TRUE)
# }
Run the code above in your browser using DataLab