| rpygeo_save {RPyGeo} | R Documentation |
Save temporary raster to workspace
Description
This function saves temporary a raster as permanent raster to the workspace.
Usage
rpygeo_save(data, filename)
Arguments
data |
|
filename |
Filename with extension or without extension if the workspace is file geodatabase |
Details
Some ArcPy functions have no parameter to specify an output raster. Instead they return a raster object and a temporary raster is saved to the scratch workspace. This functions writes the temporary raster as a permanent raster to the workspace.
How the file is written depends on the workspace and scratch workspace environment settings.
Workspace and scratch workspace are directories: Raster is loaded with the
rasterpackage and is written to workspace directory. The file format is inferred from the file extension in thefilenameparameter.Workspace and scratch workspace are file geodatabases: Raster is copied to workspace file geodatabase. No file extension necessary for the
filenameparameter.Workspace is file geodatabase and scratch workspace is directory: Raster is copied to workspace file geodatabase. No file extension necessary for the
filenameparameter.Workspace is directory and scratch workspace is file geodatabase: Raster is exported to workspace directory. The
filenameparameter is ignored due to restrictions inarcpy.RasterToOtherFormat_conversionfunction. If the automatically generated filename already exists, a number is appended to the end of the filename.
Author(s)
Marc Becker
Examples
## Not run:
# Load packages
library(RPyGeo)
library(RQGIS)
library(magrittr)
# Get data
data(dem, package = "RQGIS")
# Load the ArcPy module and build environment
arcpy <- arcpy_build_env(overwrite = TRUE, workspace = tempdir())
# Write raster to workspace directory
writeRaster(dem, file.path(tempdir(), "dem.tif"), format = "GTiff")
# Calculate temporary aspect file and save to workspace
arcpy$sa$Aspect(in_raster = "dem.tif") %>%
rpygeo_save("aspect.tif")
## End(Not run)