rasterPrepOptions: change rasterPrep package settings

View source: R/rasterPrepOptions.R

rasterPrepOptionsR Documentation

change rasterPrep package settings

Description

This function allows the user to retrieve or change the settings for the rasterPrep package

Usage

rasterPrepOptions(...)

Arguments

...

Arguments should be settings to reset with their value the new setting. If called with no arguments nothing is changed but the current settings are returned.

Details

Settings in order of decreasing relevance:

verbose - defaults to FALSE. If TRUE than progress and GDAL Utility arguments will be printed to the console.

usesf - If TRUE use GDAL Utility wrappers from the sf package. Set to FALSE to use system installed GDAL utilities via shell, which must be installed separately. usesf = FALSE has not been tested on all platforms and may be dropped in the future.

The remaining three options are all only relevant if usesf is FALSE and are to manage the issues created by the sp and rgdal. They may be dropped in the future.

resetLibs - controls whether raster prep should attempt to reset the system environmental settings for PROJ_LIB and GDAL_DATA prior to executing system calls it defaults toTRUE.

projLib - is what the PROJ_LIB environmental setting should be when making shell calls to GDAL Utilities. It defaults to the system environment variable RASTERPREP_PROJ or if that's not set to an empty string ("").

gdalData - is what the GDAL_DATA environmental variable should be set to during shell calls (if resetsLibs is TRUE). It defaults to an empty string ("").

There's a lot of historical junk here. R spatial packages were all put in disarray when the PROJ library was updated from version 4. Prior to that change PROJ was stable and all installed GDAL versions would use the same PROJ library directory. However, when PROJ started changing it became important that the right PROJ directory was used. To get around PROJ version conflicts sp and rgdal started changing system environmental variables when they were loaded. This helped calls to GDAL from those packages find the right PROJ directory but would break calls from R to the system installed GDAL if it used a different PROJ version. In response rasterPrep would defensively reset the the PROJ_LIB and GDAL_DATA environmental variables for the duration of the system calls it made.

See: https://github.com/r-spatial/discuss/issues/31 for a discussion of this 'issue.

rasterPrep currently uses sf by default bypassing all these complications. As of April 2024 this is new, but assuming it proves stable the options to use system commands (usesf = FALSE) may be dropped completely.

Value

a list of the current settings is returned if the function is called with no arguments.


ethanplunkett/rasterPrep documentation built on Sept. 17, 2024, 1:05 p.m.