gdalmanage: gdalmanage

Description Usage Arguments Details Value Author(s) References Examples

View source: R/gdalmanage.R

Description

R wrapper for gdalmanage: Identify, delete, rename and copy raster data files

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
gdalmanage(
  mode,
  datasetname,
  newdatasetname,
  r,
  u,
  f,
  ignore.full_scan = TRUE,
  verbose = FALSE
)

Arguments

mode

Character. Mode of operation. "identify" | "copy" | "rename" | "delete". See details.

datasetname

Character. Raster file to operate on.

newdatasetname

Character. For copy and rename modes, you provide a source filename and a target filename, just like copy and move commands in an operating system.

r

Logical. Recursively scan files/folders for raster files.

u

Logical. Report failures if file type is unidentified.

f

Character. format. Specify format of raster file if unknown by the application. Uses short data format name (e.g. GTiff).

ignore.full_scan

Logical. If FALSE, perform a brute-force scan if other installs are not found. Default is TRUE.

verbose

Logical. Enable verbose execution? Default is FALSE.

Details

This is an R wrapper for the 'gdalmanage' function that is part of the Geospatial Data Abstraction Library (GDAL). It follows the parameter naming conventions of the original function, with some modifications to allow for more R-like parameters. For all parameters, the user can use a single character string following, precisely, the gdalinfo format (http://gdal.org/gdalmanage.html), or, in some cases, can use R vectors to achieve the same end.

Mode of operation

This function assumes the user has a working GDAL on their system. If the "gdalUtils_gdalPath" option has been set (usually by gdal_setInstallation), the GDAL found in that path will be used. If nothing is found, gdal_setInstallation will be executed to attempt to find a working GDAL.

Value

Character.

Author(s)

Jonathan A. Greenberg (gdalUtils@estarcion.net) (wrapper) and Frank Warmerdam (GDAL lead developer).

References

http://www.gdal.org/gdalmanage.html

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
29
30
31
32
33
34
gdal_setInstallation()
valid_install <- !is.null(getOption("gdalUtils_gdalPath"))
if(valid_install)
{
	# Using identify mode
	# Report the data format of the raster file by using the identify mode 
 # and specifying a data file name:
	src_dataset <- system.file("external/tahoe_highrez.tif", package="gdalUtils")
	gdalmanage(mode="identify",datasetname=src_dataset)
	
	# Recursive mode will scan subfolders and report the data format:	
	src_dir <- system.file("external/", package="gdalUtils")
	gdalmanage(mode="identify",datasetname=src_dir,r=TRUE)
	
## Not run: 
		# Using copy mode	
		# Copy the raster data:
		file_copy <- tempfile(fileext=".tif")
		gdalmanage(mode="copy",src_dataset,file_copy)	
		file.exists(file_copy)
		
		# Using rename mode
		# Rename the raster data:
		new_name <- tempfile(fileext=".tif")
		gdalmanage(mode="rename",file_copy,new_name)	
		file.exists(new_name)
		
		# Using delete mode
		# Delete the raster data:
		gdalmanage(mode="delete",new_name)	
		file.exists(new_name)		

## End(Not run)
}

gdalUtils documentation built on Feb. 14, 2020, 1:08 a.m.