From 64051cc28275390c70e61924ee961346f7d9f541 Mon Sep 17 00:00:00 2001 From: Chris Reudenbach Date: Sat, 11 May 2024 23:20:35 +0200 Subject: [PATCH 1/2] df --- vignettes/link2GI2.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/link2GI2.Rmd b/vignettes/link2GI2.Rmd index e428d42..c214730 100644 --- a/vignettes/link2GI2.Rmd +++ b/vignettes/link2GI2.Rmd @@ -50,7 +50,7 @@ The `find' functions provide an overview of the installed software. These functi If you are just calling link2GI on the fly, i.e. for a single temporary operation, there is no need to set up folders and project structures. If you are working on a more complex project, it might be helpful to have a fixed structure. The same goes for existing `GRASS` projects that need to be in specific mapsets and locations. -A simple (you can call it dirty) approach is the ìnitProjî function, which creates folder structures (if not existing) and sets global variables (if desired) containing the paths as strings. +A simple (you can call it dirty) approach is the `initProj` function, which creates folder structures (if not existing) and sets global variables (if desired) containing the paths as strings. ```{r, eval=FALSE} require(link2GI) From fb35822eed4b401637c5140614dc13ebc3935668 Mon Sep 17 00:00:00 2001 From: Chris Reudenbach Date: Mon, 13 May 2024 01:01:04 +0200 Subject: [PATCH 2/2] update ein linkgrass --- R/gdalControls.R | 4 +++- R/grassControl.R | 10 +++++++--- R/link2giKarim.R | 5 +++++ R/linkGRASS.R | 1 - R/otbControls.R | 3 ++- R/sagaControl.R | 4 +++- docs/articles/link2GI1.html | 2 +- docs/articles/link2GI2.html | 25 ++++++++++++++++--------- docs/articles/link2GI3.html | 2 +- docs/articles/link2GI4.html | 4 ++-- docs/articles/link2GI5.html | 2 +- docs/articles/link2GI6.html | 2 +- docs/articles/link2GI7.html | 2 +- docs/authors.html | 5 ++--- docs/pkgdown.yml | 2 +- docs/reference/runOTB.html | 4 ++-- docs/sitemap.xml | 10 +++++----- vignettes/link2GI2.Rmd | 2 +- vignettes/link2GI2.html | 6 +++--- vignettes/link2GI2.md | 6 +++--- 20 files changed, 60 insertions(+), 41 deletions(-) diff --git a/R/gdalControls.R b/R/gdalControls.R index 6a11d2b..4d32749 100644 --- a/R/gdalControls.R +++ b/R/gdalControls.R @@ -293,7 +293,9 @@ findGDAL <- function(searchLocation = "default", if (Sys.info()["sysname"] == "Windows") { if (searchLocation=="default") searchLocation <- "C:/" - if (grepl(paste0(LETTERS, ":", collapse="|"), searchLocation)) + else searchLocation = normalizePath(searchLocation) + if (grepl(paste0(LETTERS, ":", collapse="|"), substr(toupper(searchLocation),start = 1,stop = 2))) + link = link2GI::searchGDALW(DL = searchLocation, quiet=TRUE) else stop("You are running Windows - Please choose a suitable searchLocation argument that MUST include a Windows drive letter and colon" ) diff --git a/R/grassControl.R b/R/grassControl.R index 1b79751..c3de327 100644 --- a/R/grassControl.R +++ b/R/grassControl.R @@ -580,10 +580,14 @@ findGRASS <- function(searchLocation = "default", quiet=TRUE) { if (Sys.info()["sysname"] == "Windows") { - message("PLEASE NOTE: if you use GRASS version > 7.8 and/or the OSGeo4W installation you must:\n 1) start the OSGeo4W shell\n 2) start grassxx --gtext\n 3) start Rstudio\n Then both link2GI and rgrass should work.") - invisible(readline(prompt="Press [enter] to continue")) + if (!grepl(x = system("o-help",intern =T),pattern = "OSGeo4W Shell Commands", fixed = TRUE)[1]){ + message("PLEASE NOTE: if you use GRASS version > 7.8 and/or the OSGeo4W installation you must:\n 1) start the OSGeo4W shell\n 2) start grassxx --gtext\n 3) start Rstudio from command line in the shell\n Then both link2GI and rgrass should work.") + invisible(readkey()) + } if (searchLocation=="default") searchLocation <- "C:/" - if (grepl(paste0(LETTERS, ":", collapse="|"), searchLocation) ) + else searchLocation = normalizePath(searchLocation) + if (grepl(paste0(LETTERS, ":", collapse="|"), substr(toupper(searchLocation),start = 1,stop = 2))) + link = link2GI::searchGRASSW(DL = searchLocation) else return(cat("You are running Windows - Please choose a suitable searchLocation argument that MUST include a Windows drive letter and colon")) } else { diff --git a/R/link2giKarim.R b/R/link2giKarim.R index f88351c..78bcd01 100644 --- a/R/link2giKarim.R +++ b/R/link2giKarim.R @@ -387,3 +387,8 @@ reverse_bf_wpath = function(path){ path = utils::shortPathName(path) return(path) } +readkey <- function() +{ + cat("[press [ESC] to continue]") + line <- readline() +} diff --git a/R/linkGRASS.R b/R/linkGRASS.R index e6d76d6..d652a7d 100644 --- a/R/linkGRASS.R +++ b/R/linkGRASS.R @@ -263,7 +263,6 @@ linkGRASS = function(x = NULL, returnPaths = TRUE rgrass::initGRASS(gisBase = grass$gisbase_GRASS, home = home, - use_g.dirseps.exe = FALSE, gisDbase = gisdbase, mapset = "PERMANENT", location = location, diff --git a/R/otbControls.R b/R/otbControls.R index 7d8444d..f2bcecc 100644 --- a/R/otbControls.R +++ b/R/otbControls.R @@ -223,7 +223,8 @@ findOTB <- function(searchLocation = "default", if (Sys.info()["sysname"] == "Windows") { if (searchLocation=="default") searchLocation <- "C:/" - if (grepl(paste0(LETTERS, ":", collapse="|"), searchLocation)) + else searchLocation = normalizePath(searchLocation) + if (grepl(paste0(LETTERS, ":", collapse="|"), substr(toupper(searchLocation),start = 1,stop = 2))) link = link2GI::searchOTBW(DL = searchLocation, quiet=TRUE) else stop("You are running Windows - Please choose a suitable searchLocation argument that MUST include a Windows drive letter and colon" ) diff --git a/R/sagaControl.R b/R/sagaControl.R index 82cf700..7225ad0 100644 --- a/R/sagaControl.R +++ b/R/sagaControl.R @@ -226,7 +226,9 @@ findSAGA <- function(searchLocation = "default", if (Sys.info()["sysname"] == "Windows") { if (searchLocation=="default") searchLocation <- "C:/" - if (grepl(paste0(LETTERS, ":", collapse="|"), searchLocation)) + else searchLocation = normalizePath(searchLocation) + if (grepl(paste0(LETTERS, ":", collapse="|"), substr(toupper(searchLocation),start = 1,stop = 2))) + link = link2GI::searchSAGAW(DL = searchLocation,quiet = quiet) else stop("You are running Windows - Please choose a suitable searchLocation argument that MUST include a Windows drive letter and colon" ) } else { diff --git a/docs/articles/link2GI1.html b/docs/articles/link2GI1.html index 3e827e9..cacbec3 100644 --- a/docs/articles/link2GI1.html +++ b/docs/articles/link2GI1.html @@ -100,7 +100,7 @@

Link GI to R

Chris Reudenbach

-

2024-05-11

+

2024-05-13

Source: vignettes/link2GI1.Rmd diff --git a/docs/articles/link2GI2.html b/docs/articles/link2GI2.html index a204eeb..bc32916 100644 --- a/docs/articles/link2GI2.html +++ b/docs/articles/link2GI2.html @@ -100,7 +100,7 @@

link2GI Basic Examples

Chris Reudenbach

-

2024-05-11

+

2024-05-13

Source: vignettes/link2GI2.Rmd @@ -143,9 +143,10 @@

Setting up project structures
 require(link2GI)
 dirs = link2GI::createFolders(root_folder = tempdir(),
@@ -172,11 +173,17 @@ 

linkSAGA - Find and set up

linkGRASS - Find and set up GRASS 7/8 API bindings

-

linkGRASSinitializes the session environment and system paths for easy access toGRASS -GIS -7.x./8.x. The correct setting of spatial and projection parameters is done automatically either by using an existing and validrasterorterra,sporsfobject or manually by providing a list of minimum required parameters. These properties are used to initialize either a temporary or a permanentrgrassenvironment, including the correctGRASS -7/8database structure. If you do not specify any of the above,linkGRASS` -will create an EPSG:4326 worldwide site.

+

linkGRASS initializes the session environment and system +paths for easy access to GRASS GIS 7.x./8.x. The correct +setting of spatial and projection parameters is done automatically +either by using an existing and valid raster or +terra, sp or sf object or +manually by providing a list of minimum required parameters. These +properties are used to initialize either a temporary or a permanent +rgrass environment, including the correct +GRASS 7/8 database structure. If you do not specify any of +the above, linkGRASS will create an EPSG:4326 worldwide +site.

The most time consuming part on Windows systems is the search process. This can easily take 10 minutes or more. To speed up this process, you can also provide a correct parameter set. The best way to diff --git a/docs/articles/link2GI3.html b/docs/articles/link2GI3.html index 86364f9..883f926 100644 --- a/docs/articles/link2GI3.html +++ b/docs/articles/link2GI3.html @@ -100,7 +100,7 @@

linkGRASS real world data usecase

Chris Reudenbach

-

2024-05-11

+

2024-05-13

Source: vignettes/link2GI3.Rmd diff --git a/docs/articles/link2GI4.html b/docs/articles/link2GI4.html index 93f831f..263021a 100644 --- a/docs/articles/link2GI4.html +++ b/docs/articles/link2GI4.html @@ -100,7 +100,7 @@

OTB Wrapper

Chris Reudenbach

-

2024-05-11

+

2024-05-13

Source: vignettes/link2GI4.Rmd @@ -156,7 +156,7 @@

A typical use case for cmd<-parseOTBFunction(algo = algoKeyword, gili = otblink) ## get help using the convenient listviewer -listviewer::jsonedit(cmd$help) +listviewer::jsonedit(cmd$help) ## define the mandantory arguments all other will be default cmd$input_in <- fn diff --git a/docs/articles/link2GI5.html b/docs/articles/link2GI5.html index 6cc9819..d0e57a9 100644 --- a/docs/articles/link2GI5.html +++ b/docs/articles/link2GI5.html @@ -100,7 +100,7 @@

Reproducible projects

Chris Reudenbach

-

2024-05-11

+

2024-05-13

Source: vignettes/link2GI5.Rmd diff --git a/docs/articles/link2GI6.html b/docs/articles/link2GI6.html index 75919d1..2cb2954 100644 --- a/docs/articles/link2GI6.html +++ b/docs/articles/link2GI6.html @@ -100,7 +100,7 @@

GEOSTAT 2018 Examples

Chris Reudenbach

-

2024-05-11

+

2024-05-13

Source: vignettes/link2GI6.Rmd diff --git a/docs/articles/link2GI7.html b/docs/articles/link2GI7.html index 1931e7f..7525a30 100644 --- a/docs/articles/link2GI7.html +++ b/docs/articles/link2GI7.html @@ -101,7 +101,7 @@

Installation guide for link2GI related

Chris Reudenbach

-

2024-05-11

+

2024-05-13

Source: vignettes/link2GI7.Rmd diff --git a/docs/authors.html b/docs/authors.html index fd592e2..0c2dab6 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -95,14 +95,13 @@

Citation

Reudenbach C (2024). link2GI: Linking Geographic Information Systems, Remote Sensing and Other Command Line Tools. -R package version 0.6-1, https://r-spatial.github.io/link2GI/, https://github.com/r-spatial/link2GI/. +https://github.com/r-spatial/link2GI/, https://r-spatial.github.io/link2GI/.

@Manual{,
   title = {link2GI: Linking Geographic Information Systems, Remote Sensing and Other Command Line Tools},
   author = {Chris Reudenbach},
   year = {2024},
-  note = {R package version 0.6-1, https://r-spatial.github.io/link2GI/},
-  url = {https://github.com/r-spatial/link2GI/},
+  note = {https://github.com/r-spatial/link2GI/, https://r-spatial.github.io/link2GI/},
 }
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index bfbb2ac..03d79c0 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -9,7 +9,7 @@ articles: link2GI5: link2GI5.html link2GI6: link2GI6.html link2GI7: link2GI7.html -last_built: 2024-05-11T05:43Z +last_built: 2024-05-12T22:58Z urls: reference: https://r-spatial.github.io/link2GI/reference article: https://r-spatial.github.io/link2GI/articles diff --git a/docs/reference/runOTB.html b/docs/reference/runOTB.html index 0b13189..c3e55b9 100644 --- a/docs/reference/runOTB.html +++ b/docs/reference/runOTB.html @@ -140,7 +140,7 @@

Examples

## Please NOTE: ## You must check the help to identify the correct argument codewort ($input_in or $input_il) -listviewer::jsonedit(cmd$help) +listviewer::jsonedit(cmd$help) ## define the mandatory arguments all other will be default cmd$input_in <- fn @@ -161,7 +161,7 @@

Examples

cmd<-parseOTBFunction(algo = algoKeyword, gili = otblink) ## get help using the convenient listviewer -listviewer::jsonedit(cmd$help) +listviewer::jsonedit(cmd$help) ## define the mandatory arguments all other will be default cmd$input_il <- file.path(tempdir(),"test.tif") diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 3f68b41..4c25ed2 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -3,9 +3,6 @@ https://r-spatial.github.io/link2GI/404.html - - https://r-spatial.github.io/link2GI/LICENSE-text.html - https://r-spatial.github.io/link2GI/articles/index.html @@ -36,6 +33,9 @@ https://r-spatial.github.io/link2GI/index.html + + https://r-spatial.github.io/link2GI/LICENSE-text.html + https://r-spatial.github.io/link2GI/news/index.html @@ -100,10 +100,10 @@ https://r-spatial.github.io/link2GI/reference/loadLibraries.html - https://r-spatial.github.io/link2GI/reference/makGlobalVar.html + https://r-spatial.github.io/link2GI/reference/makeGlobalVariable.html - https://r-spatial.github.io/link2GI/reference/makeGlobalVariable.html + https://r-spatial.github.io/link2GI/reference/makGlobalVar.html https://r-spatial.github.io/link2GI/reference/manuallyBuild.html diff --git a/vignettes/link2GI2.Rmd b/vignettes/link2GI2.Rmd index 4766cce..61e4ca9 100644 --- a/vignettes/link2GI2.Rmd +++ b/vignettes/link2GI2.Rmd @@ -80,7 +80,7 @@ saga1 ## linkGRASS - Find and set up GRASS 7/8 API bindings -linkGRASS` initializes the session environment and system paths for easy access to `GRASS GIS 7.x./8.x`. The correct setting of spatial and projection parameters is done automatically either by using an existing and valid `raster` or `terra`, `sp` or `sf` object or manually by providing a list of minimum required parameters. These properties are used to initialize either a temporary or a permanent `rgrass` environment, including the correct `GRASS 7/8` database structure. If you do not specify any of the above, `linkGRASS` will create an EPSG:4326 worldwide site. +`linkGRASS` initializes the session environment and system paths for easy access to `GRASS GIS 7.x./8.x`. The correct setting of spatial and projection parameters is done automatically either by using an existing and valid `raster` or `terra`, `sp` or `sf` object or manually by providing a list of minimum required parameters. These properties are used to initialize either a temporary or a permanent `rgrass` environment, including the correct `GRASS 7/8` database structure. If you do not specify any of the above, `linkGRASS` will create an EPSG:4326 worldwide site. The most time consuming part on Windows systems is the search process. This can easily take 10 minutes or more. To speed up this process, you can also provide a correct parameter set. The best way to do this is to call `findGRASS` manually. Then call `linkGRASS` with the returned version arguments of your choice. diff --git a/vignettes/link2GI2.html b/vignettes/link2GI2.html index 59d09cf..153d174 100644 --- a/vignettes/link2GI2.html +++ b/vignettes/link2GI2.html @@ -142,7 +142,7 @@

link2GI Basic Examples

Chris Reudenbach

-

2024-05-10

+

2024-05-13

Using the link2GI package - Basic examples

@@ -163,7 +163,7 @@

Brute force search usage

The `find’ functions provide an overview of the installed software. These functions do not create links or change settings.

Setting up project structures

If you are just calling link2GI on the fly, i.e. for a single temporary operation, there is no need to set up folders and project structures. If you are working on a more complex project, it might be helpful to have a fixed structure. The same goes for existing GRASS projects that need to be in specific mapsets and locations.

-

A simple (you can call it dirty) approach is the ìnitProjî function, which creates folder structures (if not existing) and sets global variables (if desired) containing the paths as strings.

+

A simple (you can call it dirty) approach is the initProj function, which creates folder structures (if not existing) and sets global variables (if desired) containing the paths as strings.

require(link2GI)
 dirs = link2GI::createFolders(root_folder = tempdir(),
                                 folders = c("data/",
@@ -178,7 +178,7 @@ 

Setting up project structures

linkSAGA - Find and set up ‘SAGA’ API bindings

In the past it was quite tedious to link the correct SAGA GIS version. Since version 1.x.x of RSAGA things are much better. The new RSAGA::rsaga.env() function is to get the first RSAGA version in the search path. It is also possible to pass the version number as shown below. Storing the result in appropriate variables will even allow you to easily switch between different SAGA GIS installations.

linkGRASS - Find and set up GRASS ⅞ API bindings

-

linkGRASSinitializes the session environment and system paths for easy access toGRASS GIS 7.x./8.x. The correct setting of spatial and projection parameters is done automatically either by using an existing and valid rasterorterra, sporsfobject or manually by providing a list of minimum required parameters. These properties are used to initialize either a temporary or a permanentrgrassenvironment, including the correctGRASS 7/8database structure. If you do not specify any of the above,linkGRASS` will create an EPSG:4326 worldwide site.

+

linkGRASS initializes the session environment and system paths for easy access to GRASS GIS 7.x./8.x. The correct setting of spatial and projection parameters is done automatically either by using an existing and valid raster or terra, sp or sf object or manually by providing a list of minimum required parameters. These properties are used to initialize either a temporary or a permanent rgrass environment, including the correct GRASS 7/8 database structure. If you do not specify any of the above, linkGRASS will create an EPSG:4326 worldwide site.

The most time consuming part on Windows systems is the search process. This can easily take 10 minutes or more. To speed up this process, you can also provide a correct parameter set. The best way to do this is to call findGRASS manually. Then call linkGRASS with the returned version arguments of your choice.

The linkGRASS function tries to find all valid GRASS GIS binaries by analyzing the GRASS GIS startup script files. After identifying the GRASS GIS binaries, all necessary system variables and settings are generated and passed to a temporary R environment.

If you have more than one valid installation and run linkGRASS with the arguments select_ver = TRUE, you will be asked to select one.

diff --git a/vignettes/link2GI2.md b/vignettes/link2GI2.md index acc23da..a19ad4b 100644 --- a/vignettes/link2GI2.md +++ b/vignettes/link2GI2.md @@ -1,7 +1,7 @@ --- author: "Chris Reudenbach" title: "link2GI Basic Examples" -date: "2024-05-10" +date: "2024-05-13" editor_options: chunk_output_type: console output: @@ -52,7 +52,7 @@ The `find' functions provide an overview of the installed software. These functi If you are just calling link2GI on the fly, i.e. for a single temporary operation, there is no need to set up folders and project structures. If you are working on a more complex project, it might be helpful to have a fixed structure. The same goes for existing `GRASS` projects that need to be in specific mapsets and locations. -A simple (you can call it dirty) approach is the ìnitProjî function, which creates folder structures (if not existing) and sets global variables (if desired) containing the paths as strings. +A simple (you can call it dirty) approach is the `initProj` function, which creates folder structures (if not existing) and sets global variables (if desired) containing the paths as strings. ```r @@ -77,7 +77,7 @@ In the past it was quite tedious to link the correct `SAGA GIS` version. Since v ## linkGRASS - Find and set up GRASS 7/8 API bindings -linkGRASS` initializes the session environment and system paths for easy access to `GRASS GIS 7.x./8.x`. The correct setting of spatial and projection parameters is done automatically either by using an existing and valid `raster` or `terra`, `sp` or `sf` object or manually by providing a list of minimum required parameters. These properties are used to initialize either a temporary or a permanent `rgrass` environment, including the correct `GRASS 7/8` database structure. If you do not specify any of the above, `linkGRASS` will create an EPSG:4326 worldwide site. +`linkGRASS` initializes the session environment and system paths for easy access to `GRASS GIS 7.x./8.x`. The correct setting of spatial and projection parameters is done automatically either by using an existing and valid `raster` or `terra`, `sp` or `sf` object or manually by providing a list of minimum required parameters. These properties are used to initialize either a temporary or a permanent `rgrass` environment, including the correct `GRASS 7/8` database structure. If you do not specify any of the above, `linkGRASS` will create an EPSG:4326 worldwide site. The most time consuming part on Windows systems is the search process. This can easily take 10 minutes or more. To speed up this process, you can also provide a correct parameter set. The best way to do this is to call `findGRASS` manually. Then call `linkGRASS` with the returned version arguments of your choice.