Learn R Programming

link2GI

Package website: release

link2GI provide some functions which make it a bit easier to connect straightforward the common open source GI software packages to the R-biotop. It supports both the use of wrapper packages and the direct API-use via system calls. It focuses on Linux and WindowsX operating systems but nevertheless it should also work with OSX.

If you have several versions installed or if you want to use the full power of the GI software it will be a nice and helpful tool to deal with some strange behaviours and requirements. Especially helpful is the support of OTB, the GDAL-Python functions and a simple support to use any SAGA version via the CLI. Hopefully RSAGA and Rsagacmd will join forces in one package in the future. Anyway the brand new release 1.2.0 of RSAGA as well as the current Rsagacmd will work with the environment settings as provided by linkSAGA.

Installation

link2GIis up to CRAN. For the installation of the stable version please use install.packages("link2GI").

To install the latest stable version use:

# devtools package
devtools::install_github("r-spatial/link2GI", ref = "master")
# remotes package
remotes::install_github("r-spatial/link2GI",ref = "master")

Third Party software

To utilize the power of the open source GI tools from within R you need to install them first. As a first promising opportunity to do fulfill most of the requirements you may install QGIS, GRASS- and SAGA-GIS .

Documentation

Updated OTB wrapper

the OTB wrapper is updated for a more convinient usage. Please have a look at the usecase below:


## link to OTB
require(link2GI)
require(terra)
require(listviewer)

otblink<-link2GI::linkOTB()
projRootDir<-tempdir()

fn <- system.file("ex/elev.tif", package = "terra")


## for the example we use the edge detection, 
algoKeyword<- "EdgeExtraction"

## extract the command list for the choosen algorithm 
cmd<-parseOTBFunction(algo = algoKeyword, gili = otblink)

## get help using the convenient listviewer
listviewer::jsonedit(cmd$help)

## define the mandantory arguments all other will be default
cmd$input  <- fn
cmd$filter <- "touzi"
cmd$channel <- 2
cmd$out <- file.path(projRootDir,paste0("out",cmd$filter,".tif"))

## run algorithm
retStack<-runOTB(cmd,gili = otblink)

## plot filter raster on the green channel
plot(retStack)

Online Vignette

Online Vignettes

Usecases presented on the GEOSTAT August 2018

During the GEOSTAT 2018 (see https://opengeohub.org) in Prague some more complex usescases have been presented.

Slides and materials

Basic usage of SAGA and OTB calls

Wrapping GRASS

GRASS based cost analysis

API/CLI mixed approach

Copy Link

Version

Install

install.packages('link2GI')

Monthly Downloads

993

Version

0.5-3

License

GPL (>= 3) | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Chris Reudenbach

Last Published

October 30th, 2023

Functions in link2GI (0.5-3)

searchGRASSX

Return attributes of valid 'GRASS GIS' installation(s) in 'Linux'
searchOTBX

Search recursively for valid 'OTB' installation(s) on a 'Linux' OS
runOTB

Execute the OTB command list via system call
setenvGRASSw

Usually for internally usage, create valid 'GRASS GIS 7.xx' rsession environment settings according to the selected GRASS GIS 7.x and Windows Version
searchGDALW

Search recursively for valid 'GDAL' installation(s) on a 'Windows' OS
setenvOTB

Usually for internally usage, initializes and set up access to the 'OTB' command line interface
searchOTBW

Search recursively for valid 'OTB' installation(s) on a 'Windows' OS
linkSAGA

Identifies SAGA GIS Installations and returns linking Informations
searchSAGAW

Searches recursively for existing 'Windows' 'SAGA GIS' installation(s)
linkGRASS7

Deprecated only for backwards compatibility Locate and set up 'GRASS' API bindings
sf2gvec

Write sf object directly to `GRASS` vector utilising an existing or creating a new GRASS environment
searchGDALX

Search recursively for valid 'GDAL' installation(s) on a 'Windows' OS
paramGRASSw

Usually for internally usage get 'GRASS GIS' and rgrass parameters on 'Windows' OS
searchGRASSW

Search recursivly valid 'GRASS GIS' installation(s) on a given 'Windows' drive
paramGRASSx

Usually for internally usage, get 'GRASS GIS' and rgrass parameters on 'Linux' OS
setenvGDAL

Usually for internally usage, initializes and set up access to the 'GDAL' command line interface
searchSAGAX

Searches recursively for existing 'Windows' 'SAGA GIS' installation(s)
findGRASS

Return attributes of valid 'GRASS GIS' installation(s) on the system
add2Path

Adds a defined variable and value to the global search path
gvec2sf

Converts from an existing `GRASS` environment an arbitrary vector dataset into a sf object
linkAll

convenient function to establish all link2GI links
linkGDAL

Locate and set up 'GDAL' API bindings
initProj

Defines and creates folders and variables
findOTB

Search recursivly existing 'Orfeo Toolbox' installation(s) at a given drive/mountpoint
findGDAL

Search recursivly existing 'GDAL binaries' installation(s) at a given drive/mountpoint
makGlobalVar

Generates a variable with a certain value in the R environment
findSAGA

Search recursivly existing 'SAGA GIS' installation(s) at a given drive/mountpoint
parseOTBAlgorithms

Get OTB modules
parseOTBFunction

Get OTB function argument list
linkGRASS

Locate and set up 'GRASS' API bindings
linkOTB

Locate and set up 'Orfeo ToolBox' API bindings
getSpatialClass

Checks if x is of type raster,terra,sf or sp
manuallyBuild

Build package manually