Skip to content

Commit

Permalink
prelim fix #62 typos
Browse files Browse the repository at this point in the history
  • Loading branch information
gisma committed Apr 22, 2024
1 parent 3793ac3 commit bffa61c
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 33 deletions.
2 changes: 1 addition & 1 deletion R/gdalControls.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'@description Initializes and set up access to the 'GDAL' command line interface
#'
#'@param bin_GDAL string contains the path to the 'GDAL' binaries
#'@return Adds 'GDAL' pathes to the enviroment and creates the variable global string variable \code{gdalCmd}, that contains the path to the 'GDAL' binaries.
#'@return Adds 'GDAL' pathes to the environment and creates the variable global string variable \code{gdalCmd}, that contains the path to the 'GDAL' binaries.
#'@export setenvGDAL
#'
#'@examples
Expand Down
6 changes: 3 additions & 3 deletions R/grassControl.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#'@title Usually for internally usage, get 'GRASS GIS' and \code{rgrass} parameters on 'Linux' OS
#'@name paramGRASSx
#'@description Initialize and set up \code{rgrass} for 'Linux'
#'@details During the rsession you will have full access to GRASS7 GIS via the \code{rgrass} wrappe. Additionally you may use also use the API calls of GRASS7 via the command line.
#'@details During the rsession you will have full access to GRASS7 GIS via the \code{rgrass} wrapper. Additionally you may use also use the API calls of GRASS7 via the command line.
#'@param set_default_GRASS default = NULL will force a search for 'GRASS GIS' You may provide a valid combination as
#' c("/usr/lib/grass74","7.4.1","grass74")
#'@param MP mount point to be searched. default is "/usr/bin"
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@param ver_select if TRUE you must interactivley selcect between alternative installations
#'@param quiet Boolean switch for suppressing console messages default is TRUE
#'@param ver_select if TRUE you must interactively select between alternative installations
#'@export paramGRASSx
#'
#' @examples
Expand Down
10 changes: 5 additions & 5 deletions R/linkGDAL.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ if (!isGeneric('linkGDAL')) {
#'@description Locate and set up \href{https://gdal.org/}{'GDAL - Geospatial Data Abstraction Librar'} API bindings
#'@details It looks for the \code{gdalinfo(.exe)} file. If the file is found in a \code{bin} folder it is assumed to be a valid 'GDAL' binary installation.
#'@param bin_GDAL string contains path to where the gdal binaries are located
#'@param ver_select boolean default is FALSE. If there is more than one 'GDAL' installation and \code{ver_select} = TRUE the user can select interactively the preferred 'GDAL' version
#'@param ver_select Boolean default is FALSE. If there is more than one 'GDAL' installation and \code{ver_select} = TRUE the user can select interactively the preferred 'GDAL' version
#'@param searchLocation string hard drive letter default is \code{C:}
#'@param quiet boolean switch for supressing messages default is TRUE
#'@param returnPaths boolean if set to FALSE the pathes of the selected version are written
#'@param quiet Boolean switch for suppressing messages default is TRUE
#'@param returnPaths Boolean if set to FALSE the pathes of the selected version are written
#' to the PATH variable only, otherwise all paths and versions of the installed GRASS versions ae returned.

#'
#'@note You may also set the path manually. Using a 'OSGeo4W64' \url{https://trac.osgeo.org/osgeo4w/} installation it is typically \code{C:/OSGeo4W64/bin/}
#'@author Chris Reudenbach
#'@return add gdal pathes to the enviroment and creates global variables path_GDAL
#'@details if called without any parameter \code{linkGDAL()} it performs a full search over the hardrive \code{C:}. If it finds one or more 'GDAL' binaries it will take the first hit. You have to set \code{ver_select = TRUE} for an interactive selection of the preferred version.
#'@return add gdal pathes to the environment and creates global variables path_GDAL
#'@details if called without any parameter \code{linkGDAL()} it performs a full search over the hard drive \code{C:}. If it finds one or more 'GDAL' binaries it will take the first hit. You have to set \code{ver_select = TRUE} for an interactive selection of the preferred version.
#'@export linkGDAL
#'
#'@examples
Expand Down
14 changes: 7 additions & 7 deletions R/linkGRASS.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ if (!isGeneric('linkGRASS')) {
#' or different software releases (e.g. 'GRASS 7.0.5 and GRASS 8.1.0), it becomes often cumbersome or even
#' impossible to get the correct linkages. \cr
#' The function \code{linkGRASS} tries to find all valid 'GRASS GIS' binaries by analyzing
#' the startup script files of 'GRASS GIS'. After identifying the 'GRASS GIS' binaries all
#' necessary system variables and settings will be generated and passed to a temporary R enviroment.
#' the start up script files of 'GRASS GIS'. After identifying the 'GRASS GIS' binaries all
#' necessary system variables and settings will be generated and passed to a temporary R environment.
#'@details The concept is straightforward but for an all days usage helpful. Either you need to
#' provide a \code{raster} or \code{sp} \code{sf} spatial object
#' which has correct spatial and projection properties or you may link directlxy to an existing 'GRASS' gisdbase and mapset.
#' If you choose an spatial object to initialize a correct 'GRASS' mapset it is used to create either a temporary or a permanent
#' which has correct spatial and projection properties or you may link directly to an existing 'GRASS' gisdbase and mapset.
#' If you choose an spatial object to initialize a correct 'GRASS' map set it is used to create either a temporary or a permanent
#' \href{https://CRAN.R-project.org/package=rgrass}{rgrass} environment including the correct 'GRASS ' structure.\cr\cr
#' The most time consuming part on 'Windows' Systems is the search process. This can easily take 10 or more minutes.
#' To speed up this process you can also provide a correct parameter set. Best way to do so is to call \code{searchGRASSW} or for 'Linux' \code{searchGRASSX} manually.
Expand All @@ -46,9 +46,9 @@ if (!isGeneric('linkGRASS')) {
#'@param gisdbase_exist default is FALSE if set to TRUE the arguments gisdbase and location are expected to be an existing GRASS gisdbase
#'@param spatial_params default is \code{NULL}. Instead of a spatial object you may provide the geometry as a list. E.g. c(xmin,ymin,xmax,ymax,proj4_string)
#'@param resolution resolution in map units for the GRASS raster cells
#'@param ver_select boolean if TRUE you may choose interactively the binary version (if found more than one), by default FALSE
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@param returnPaths boolean if set to FALSE the pathes of the selected version are written
#'@param ver_select Boolean if TRUE you may choose interactively the binary version (if found more than one), by default FALSE
#'@param quiet Boolean switch for suppressing console messages default is TRUE
#'@param returnPaths Boolean if set to FALSE the pathes of the selected version are written
#' to the PATH variable only, otherwise all paths and versions of the installed GRASS versions ae returned.

#'@author Chris Reudenbach
Expand Down
10 changes: 5 additions & 5 deletions R/linkOTB.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ if (!isGeneric('linkOTB')) {
#'@details It looks for the \code{otb_cli.bat} file. If the file is found in a \code{bin} folder it is assumed to be a valid 'OTB' binary installation.
#'@param bin_OTB string contains path to where the otb binaries are located
#'@param root_OTB string provides the root folder of the \code{bin_OTB}
#'@param ver_select boolean default is FALSE. If there is more than one 'OTB' installation and \code{ver_select} = TRUE the user can select interactively the preferred 'OTB' version In opposite if FALSE the newest version is automatically choosen.
#'@param ver_select Boolean default is FALSE. If there is more than one 'OTB' installation and \code{ver_select} = TRUE the user can select interactively the preferred 'OTB' version In opposite if FALSE the newest version is automatically choosen.
#'@param searchLocation string hard drive letter (Windows) or mounting point (Linux) default for Windows is \code{C:}, default for Linux is \code{~}
#'@param type_OTB string
#'@param quiet boolean switch for supressing messages default is TRUE
#'@param returnPaths boolean if set to FALSE the pathes of the selected version are written
#'@param quiet Boolean switch for suppressing messages default is TRUE
#'@param returnPaths Boolean if set to FALSE the pathes of the selected version are written
#' to the PATH variable only, otherwise all paths and versions of the installed GRASS versions ae returned.

#'
#'@note You may also set the path manually. Using a 'OSGeo4W64' \url{https://trac.osgeo.org/osgeo4w/} installation it is typically \code{C:/OSGeo4W64/bin/}
#'@author Chris Reudenbach
#'@return add otb pathes to the enviroment and creates global variables path_OTB
#'@details if called without any parameter \code{linkOTB()} it performs a full search over the hardrive \code{C:}. If it finds one or more 'OTB' binaries it will take the first hit. You have to set \code{ver_select = TRUE} for an interactive selection of the preferred version.
#'@return add otb pathes to the environment and creates global variables path_OTB
#'@details if called without any parameter \code{linkOTB()} it performs a full search over the hard drive \code{C:}. If it finds one or more 'OTB' binaries it will take the first hit. You have to set \code{ver_select = TRUE} for an interactive selection of the preferred version.
#'@export linkOTB
#'
#'@examples
Expand Down
2 changes: 1 addition & 1 deletion R/otbControls.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#'@param bin_OTB string contains the path to the 'OTB' binaries
#'@param root_OTB string contains the full string to the root folder
#' containing the 'OTB' installation'
#'@return Adds 'OTB' pathes to the enviroment and creates the variable global string variable \code{otbCmd}, that contains the path to the 'OTB' binaries.
#'@return Adds 'OTB' pathes to the environment and creates the variable global string variable \code{otbCmd}, that contains the path to the 'OTB' binaries.
#'@export setenvOTB
#'
#'@examples
Expand Down
27 changes: 18 additions & 9 deletions R/parseOTB.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#'@title Get OTB modules
#'@name parseOTBAlgorithms
#'@description retrieve the OTB module folder content and parses the module names
#'@param gili optional list of avalailable `OTB` binaries if not provided `linkOTB()` is called
#'@param gili optional list of available `OTB` binaries if not provided `linkOTB()` is called
#'@export parseOTBAlgorithms
#'
#'@examples
Expand Down Expand Up @@ -71,23 +71,32 @@ parseOTBFunction <- function(algo=NULL,gili=NULL) {
otbhelp <- list()

otbtype <- list()
path_OTB = ifelse(Sys.info()["sysname"]=="Windows", utils::shortPathName(path_OTB),path_OTB)
#path_OTB = ifelse(Sys.info()["sysname"]=="Windows", utils::shortPathName(path_OTB))

if (algo != "" & otb$exist){
system("rm otb_module_dump.txt",intern = FALSE,ignore.stderr = TRUE)
if (!identical(grep(path_OTB,pattern = "OTB-8."), integer(0) )){
system(file.path(dirname(path_OTB[[1]]),"otbenv.profile"))
system(paste0("otbcli_",algo," -help >> " ,file.path(R.utils::getAbsolutePath(tempdir()),paste0("otb_module_dump.txt 2>&1"))))
if (!identical(grep(path_OTB,pattern = "OTB-8."), integer(0) ) | !identical(grep(path_OTB,pattern = "OTB-9"), integer(0) )){
if(Sys.info()["sysname"]=="Windows"){
system(file.path(dirname(path_OTB[[1]]),"otbenv.bat"))
system2(paste0(file.path(R.utils::getAbsolutePath(path_OTB),paste0("otbcli_",algo))), paste0(" -help >> " ,file.path(R.utils::getAbsolutePath(tempdir()),paste0("otb_module_dump.txt 2>&1"))))
} else {
system(paste0(dirname(path_OTB[[1]]),"/otbenv.profile"))
system(paste0("env -i ", path_OTB, "otbcli ", algo, " -help >> ", file.path(R.utils::getAbsolutePath(tempdir()), paste0("otb_module_dump.txt 2>&1"))))
}
} else {

ifelse(Sys.info()["sysname"]=="Windows",
system(paste0("env -i ", path_OTB, "otbcli ", algo, " -help >> ", file.path(R.utils::getAbsolutePath(tempdir()), paste0("otb_module_dump.txt 2>&1")))),
#system(paste0(file.path(R.utils::getAbsolutePath(utils::shortPathName(path_OTB)),paste0("otbcli_",algo))," -help >> " ,file.path(R.utils::getAbsolutePath(tempdir()),paste0("otb_module_dump.txt 2>&1")))),
#system(paste0("env -i ", path_OTB, "otbcli ", algo, " -help >> ", file.path(R.utils::getAbsolutePath(tempdir()), paste0("otb_module_dump.txt 2>&1"))))
system(paste0(file.path(R.utils::getAbsolutePath(path_OTB),paste0("otbcli_",algo))," -help >> " ,file.path(R.utils::getAbsolutePath(tempdir()),paste0("otb_module_dump.txt 2>&1"))))
system2(paste0(file.path(R.utils::getAbsolutePath(path_OTB),paste0("otbcli_",algo))), paste0(" -help >> " ,file.path(R.utils::getAbsolutePath(tempdir()),paste0("otb_module_dump.txt 2>&1")))),
system(paste0("env -i ", path_OTB, "otbcli ", algo, " -help >> ", file.path(R.utils::getAbsolutePath(tempdir()), paste0("otb_module_dump.txt 2>&1"))))
)}
system(paste0("env -i ", path_OTB, "otbcli ", algo, " -help >> ", file.path(R.utils::getAbsolutePath(tempdir()), paste0("otb_module_dump.txt 2>&1"))))
txt <-readLines(file.path(tempdir(),"otb_module_dump.txt"))
#system(paste0("env -i ", path_OTB, "otbcli ", algo, " -help >> ", file.path(R.utils::getAbsolutePath(tempdir()), paste0("otb_module_dump.txt 2>&1"))))
ifelse(Sys.info()["sysname"]=="Windows",
txt <-readLines(paste0(tempdir(),"\\otb_module_dump.txt")),
txt <-readLines(paste0(tempdir(),"/otb_module_dump.txt"))
)

file.remove(file.path(tempdir(),"otb_module_dump.txt"))
# Pull out the appropriate line
args <- txt[grep("-", txt)]
Expand Down
4 changes: 2 additions & 2 deletions R/sagaControl.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#'@name searchSAGAX
#'@description Search for valid 'GRASS GIS' installations at a given 'Linux' mount point
#'@param MP default mount point is \code{/usr}
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@return A dataframe contasining the 'SAGA GIS' root folder(s), the version name(s) and the installation type(s)
#'@param quiet Boolean switch for suppressing console messages default is TRUE
#'@return A data frame containing the 'SAGA GIS' root folder(s), the version name(s) and the installation type(s)
#'@author Chris Reudenbach
#'@keywords internal
#'@export searchSAGAX
Expand Down

0 comments on commit bffa61c

Please sign in to comment.