rpygeo_save: Save temporary raster to workspace

Description Usage Arguments Details Author(s) Examples

View source: R/rpygeo_reticulate.R

Description

This function saves temporary a raster as permanent raster to the workspace.

Usage

1
rpygeo_save(data, filename)

Arguments

data

reticulate object or full path of the ArcPy function output

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.

Author(s)

Marc Becker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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)

fapola/RPyGeo documentation built on Nov. 13, 2018, 7:05 a.m.