migrate_virtrast: migrate "virtual rasters" to a new location

Description Usage Arguments Details Value Author(s) Examples

View source: R/migrate_virtrast.R

Description

function allowing to update the paths contained in "virtual rasters" such as GDAL VRTs or R rasterStacks "pointing" to files on disk in the case that the corresponding files on disk are moved.

Usage

1
migrate_virtrast(in_rast, new_path, out_file = NULL)

Arguments

in_rast

character full file path of an RData or vrt file

new_path

character new path were the corresponding files are now located. If NULL, a file selector is opened allowing to interactively choose the new folder, Default: NULL

out_file

character full path for the new RData or vrt file to be saved. If NULL, the new file is built nby adding "_new" to the basename of the old one. If == "overwrite", the old file is overwritten. Default: NULL

Details

DETAILS

Value

character path to the new "vrt" or "RData" file giving access to the raster files

Author(s)

Lorenzo Busetto, phD (2017) [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
 # suppose you had a gdal vrt file "pointing" to tiff files originally located in
 # "/home/mypath/myfolder", and you successively moved them to "/home/mypath/mynewfolder"
 # and you want to update the vrt file so that it keeps working

 #TODO (Remove the # after uploading a test dataset on sprawl.data)
 #old_vrt  <- "/home/mypath/myfolder/myvrt.vrt
 #new_path <- "/home/mypath/mynewfolder"
 #new_vrt  <- migrate_virtrast(old_vrt, new_path)
 #new_vrt
 #raster::stack(new_vrt)

## End(Not run)

IREA-CNR-MI/sprawl documentation built on Aug. 6, 2017, 12:56 p.m.