Subscribe to R-sig-geo feed
This is an archive for R-sig-geo, not a forum. It is not possible to post through Nabble - you may not start a new thread nor follow up an existing thread. If you wish to post, but are not subscribed to the list through the list homepage, subscribe first (through the list homepage, not via Nabble) and post from your subscribed email address. Until 2015-06-20, subscribers could post through Nabble, but policy has been changed as too many non-subscribers misunderstood the interface.
Updated: 1 hour 55 min ago

Re: error when trying to use RStudio within GRASS

Sun, 12/23/2018 - 12:42
On Sun, 23 Dec 2018, Sarah Goslee wrote:

> Hi Carlos,
>
> "This error does not show when using R instead of RStudio."
>
> Then you probably need to use RStudio help channels. You *might* get lucky
> here, but this is an R help list, not RStudio help.

Maybe also try https://lists.osgeo.org/mailman/listinfo/grass-stats, which
has a recent thread on this topic. I just tried Win10/GRASS 7.4/RStudio,
and had no trouble either running rgrass7::initGRASS() in RStudio started
on its own, or running rgrass::parseGRASS() in rstudio started in RStudio
started from the console command line inside GRASS. Consider following up
the thread on that list.

Roger

>
> Sarah
>
> On Sun, Dec 23, 2018 at 7:44 AM Carlos Rodríguez <[hidden email]>
> wrote:
>
>> Hi guys,
>>
>> I have the following error when using Rstudio within GRASS 7.2.2
>> (stand-alone version) in Windows 10:
>>
>>
>>
>> Location Spearfish_60
>>
>>> points <- readVECT("archsites")
>>
>> Error in if (get("SYS", envir = .GRASS_CACHE) == "WinNat" && nchar(WN_bat)
>> ==  :
>>
>>   missing value where TRUE/FALSE needed
>>
>>
>>> traceback()
>>
>> 7: parseGRASS(cmd, legacyExec = legacyExec)
>>
>> 6: doGRASS(cmd, flags = flags, ..., parameters = parameters, echoCmd =
>> echoCmd,
>>
>>        legacyExec = legacyExec)
>>
>> 5: execGRASS("v.in.ogr", flags = ifelse(ignore.stderr, c("f", "quiet"),
>>
>>        "f"), intern = TRUE, ignore.stderr = ignore.stderr)
>>
>> 4: .read_vect_non_plugin(vname = vname, layer = layer, type = type,
>>
>>        remove.duplicates = remove.duplicates, ignore.stderr =
>> ignore.stderr,
>>
>>        pointDropZ = pointDropZ, driver = driver, with_prj = with_prj,
>>
>>        with_c = with_c)
>>
>> 3: tryCatchList(expr, classes, parentenv, handlers)
>>
>> 2: tryCatch({
>>
>>        stopifnot(is.logical(plugin) || is.null(plugin))
>>
>>        stopifnot(is.logical(ignore.stderr))
>>
>>        if (missing(layer))
>>
>>            layer <- "1"
>>
>>        layer <- as.character(layer)
>>
>>        stopifnot(is.logical(with_c))
>>
>>        if (!is.null(driver) && driver == "GRASS")
>>
>>            plugin <- TRUE
>>
>>        if (!requireNamespace("rgdal", quietly = TRUE)) {
>>
>>            stop("rgdal not available")
>>
>>        }
>>
>>        if (is.null(plugin)) {
>>
>>            ogrD <- rgdal::ogrDrivers()$name
>>
>>            plugin <- "GRASS" %in% ogrD
>>
>>        }
>>
>>        if (plugin) {
>>
>>            res <- .read_vect_plugin(vname = vname, layer = layer,
>>
>>                type = type, ignore.stderr = ignore.stderr, pointDropZ =
>> pointDropZ,
>>
>>                mapset = mapset)
>>
>>        }
>>
>>        else {
>>
>>            res <- .read_vect_non_plugin(vname = vname, layer = layer,
>>
>>                type = type, remove.duplicates = remove.duplicates,
>>
>>                ignore.stderr = ignore.stderr, pointDropZ = pointDropZ,
>>
>>                driver = driver, with_prj = with_prj, with_c = with_c)
>>
>>        }
>>
>>    }, finally = {
>>
>>        if (get.suppressEchoCmdInFuncOption()) {
>>
>>            tull <- set.echoCmdOption(inEchoCmd)
>>
>>        }
>>
>>    })
>>
>> 1: readVECT("archsites")
>>
>>
>>
>>
>>
>> This error does not show when using R instead of RStudio. I’ve searched
>> around and tried to implement the fixes proposed for similar issues
>> (unsuccessfully).  I feel that it might be a very simple issue, but I am
>> stuck and I will appreciate any help. Here the Sys.getenv() and
>> sessionInfo(), in case there are needed.
>>
>>
>>
>>
>>> Sys.getenv()
>>
>> __COMPAT_LAYER              RunAsAdmin DetectorsWin7
>>
>> ADSK_CLM_WPAD_PROXY_CHECK   FALSE
>>
>> ALLUSERSPROFILE             C:\ProgramData
>>
>> APPDATA                     C:\Users\...\AppData\Roaming
>>
>> CLICOLOR_FORCE              1
>>
>> CommonProgramFiles          C:\Program Files\Common Files
>>
>> CommonProgramFiles(x86)     C:\Program Files (x86)\Common Files
>>
>> CommonProgramW6432          C:\Program Files\Common Files
>>
>> COMPUTERNAME
>>
>> ComSpec                     C:\WINDOWS\system32\cmd.exe
>>
>> DISPLAY                     :0
>>
>> DriverData                  C:\Windows\System32\Drivers\DriverData
>>
>> FP_NO_HOST_CHECK            NO
>>
>> GDAL_DATA                   C:/Program Files/R/R-3.5.1/library/rgdal/gdal
>>
>> GEODA_GDAL_DATA             C:\Program Files\GeoDa Software\data
>>
>> GEODA_OGR_DRIVER_PATH       C:\Program Files\GeoDa Software
>>
>> GFORTRAN_STDERR_UNIT        -1
>>
>> GFORTRAN_STDOUT_UNIT        -1
>>
>> GRASS_MESSAGE_FORMAT        text
>>
>> GRASS_PAGER                 cat
>>
>> HOME                        C:/Users/…/Documents
>>
>> HOMEDRIVE                   C:
>>
>> HOMEPATH                    \Users\...
>>
>> JRI_HOME
>> C:\Users\...\Documents\R\win-library\3.4\rJava\jri
>>
>> LOCALAPPDATA                C:\Users\...\AppData\Local
>>
>> LOGONSERVER                 \\...
>>
>> MSYS2_ENV_CONV_EXCL         R_ARCH
>>
>> NUMBER_OF_PROCESSORS        8
>>
>> OneDrive                    C:\Users\...\OneDrive
>>
>> OS                          Windows_NT
>>
>> PATH                        C:\Program
>>
>>
>> Files\R\R-3.5.1\bin\x64;C:\Rtools\bin;C:\ProgramData\Oracle\Java\javapath;c:\Rtools\gcc-4.6.3\bin;C:\Program
>>
>>                             Files (x86)\Intel\iCLS Client\;C:\Program
>>
>>                             Files\Intel\iCLS
>>
>>
>> Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
>>
>>                             Files\Intel\Intel(R) Management Engine
>>
>>                             Components\DAL;C:\Program Files\Intel\Intel(R)
>>
>>                             Management Engine Components\IPT;C:\Program
>> Files
>>
>>                             (x86)\Intel\Intel(R) Management Engine
>>
>>                             Components\DAL;C:\Program Files
>> (x86)\Intel\Intel(R)
>>
>>                             Management Engine Components\IPT;C:\Program
>> Files
>>
>>                             (x86)\ATI
>> Technologies\ATI.ACE\Core-Static;C:\Program
>>
>>                             Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program
>>
>>                             Files\Git\cmd;C:\Program Files
>>
>>                             (x86)\Skype\Phone\;C:\Program
>>
>>                             Files\R\R-3.5.1\bin\x64;C:\Program
>>
>>
>> Files\RStudio\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program
>>
>>                             Files (x86)\Calibre2\;C:\Program
>>
>>                             Files\Intel\WiFi\bin\;C:\Program Files\Common
>>
>>                             Files\Intel\WirelessCommon\;C:\Users\...
>> \AppData\Local\Microsoft\WindowsApps
>>
>> PATHEXT
>>  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
>>
>> PROCESSOR_ARCHITECTURE      AMD64
>>
>> PROCESSOR_IDENTIFIER        Intel64 Family 6 Model 60 Stepping 3,
>> GenuineIntel
>>
>> PROCESSOR_LEVEL             6
>>
>> PROCESSOR_REVISION          3c03
>>
>> ProgramData                 C:\ProgramData
>>
>> ProgramFiles                C:\Program Files
>>
>> ProgramFiles(x86)           C:\Program Files (x86)
>>
>> ProgramW6432                C:\Program Files
>>
>> PROJ_LIB                    C:/Program Files/R/R-3.5.1/library/rgdal/proj
>>
>> PSModulePath
>> C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
>>
>> PUBLIC                      C:\Users\Public
>>
>> R_ARCH                      /x64
>>
>> R_COMPILED_BY               gcc 4.9.3
>>
>> R_DOC_DIR                   C:/PROGRA~1/R/R-35~1.1/doc
>>
>> R_HOME                      C:/PROGRA~1/R/R-35~1.1
>>
>> R_LIBS_USER                 C:\Program Files\R\R-3.5.1\library
>>
>> R_MAP_DATA_DIR              C:/Program
>> Files/R/R-3.5.1/library/maps/mapdata/
>>
>> R_MAP_DATA_DIR_WORLD        C:/Program
>> Files/R/R-3.5.1/library/maps/mapdata/
>>
>> R_USER                      C:/Users/…/Documents
>>
>> RCRAN                       C:\Program Files\R\R-3.5.1\bin\x64
>>
>> RMARKDOWN_MATHJAX_PATH      C:/Program Files/RStudio/resources/mathjax-26
>>
>> RS_LOCAL_PEER               \\.\pipe\30976-rsession
>>
>> RS_RPOSTBACK_PATH           C:/Program Files/RStudio/bin/rpostback
>>
>> RS_SHARED_SECRET            63341846741
>>
>> RSTUDIO                     1
>>
>> RSTUDIO_CONSOLE_COLOR       256
>>
>> RSTUDIO_CONSOLE_WIDTH       80
>>
>> RSTUDIO_MSYS_SSH            C:/Program Files/RStudio/bin/msys-ssh-1000-18
>>
>> RSTUDIO_PANDOC              C:/Program Files/RStudio/bin/pandoc
>>
>> RSTUDIO_SESSION_PORT        30976
>>
>> RSTUDIO_USER_IDENTITY       …
>>
>> RSTUDIO_WINUTILS            C:/Program Files/RStudio/bin/winutils
>>
>> SystemDrive                 C:
>>
>> SystemRoot                  C:\WINDOWS
>>
>> TEMP                        C:\Users\...\AppData\Local\Temp
>>
>> TERM                        xterm-256color
>>
>> TMP                         C:\Users\...\AppData\Local\Temp
>>
>> USERDOMAIN                  …
>>
>> USERDOMAIN_ROAMINGPROFILE   …
>>
>> USERNAME                    …
>>
>> USERPROFILE                 C:\Users\...
>>
>> windir                      C:\WINDOWS
>>
>>
>>
>>
>>
>>> sessionInfo()
>>
>> R version 3.5.1 (2018-07-02)
>>
>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>>
>> Running under: Windows >= 8 x64 (build 9200)
>>
>>
>>
>> Matrix products: default
>>
>>
>>
>> locale:
>>
>> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
>> States.1252
>>
>> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
>>
>>
>> [5] LC_TIME=English_United States.1252
>>
>>
>>
>> attached base packages:
>>
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>>
>>
>> other attached packages:
>>
>>  [1] dbscan_1.1-2        rgdal_1.3-4         geostatsp_1.7.2
>>  Matrix_1.2-14
>>
>>  [5] raster_2.6-7        maptools_0.9-3      maps_3.3.0
>> spatstat_1.56-1
>>
>>  [9] rpart_4.1-13        nlme_3.1-137        spatstat.data_1.3-1
>> rgrass7_0.1-10
>>
>> [13] XML_3.98-1.16       sp_1.3-1
>>
>>
>>
>>
>>
>>
>>
>> Thanks in advance,
>>
>>
>>
>> William
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
> --
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Re: error when trying to use RStudio within GRASS

Sun, 12/23/2018 - 07:06
Hi Carlos,

"This error does not show when using R instead of RStudio."

Then you probably need to use RStudio help channels. You *might* get lucky
here, but this is an R help list, not RStudio help.

Sarah

On Sun, Dec 23, 2018 at 7:44 AM Carlos Rodríguez <[hidden email]>
wrote:

> Hi guys,
>
> I have the following error when using Rstudio within GRASS 7.2.2
> (stand-alone version) in Windows 10:
>
>
>
> Location Spearfish_60
>
> > points <- readVECT("archsites")
>
> Error in if (get("SYS", envir = .GRASS_CACHE) == "WinNat" && nchar(WN_bat)
> ==  :
>
>   missing value where TRUE/FALSE needed
>
>
> > traceback()
>
> 7: parseGRASS(cmd, legacyExec = legacyExec)
>
> 6: doGRASS(cmd, flags = flags, ..., parameters = parameters, echoCmd =
> echoCmd,
>
>        legacyExec = legacyExec)
>
> 5: execGRASS("v.in.ogr", flags = ifelse(ignore.stderr, c("f", "quiet"),
>
>        "f"), intern = TRUE, ignore.stderr = ignore.stderr)
>
> 4: .read_vect_non_plugin(vname = vname, layer = layer, type = type,
>
>        remove.duplicates = remove.duplicates, ignore.stderr =
> ignore.stderr,
>
>        pointDropZ = pointDropZ, driver = driver, with_prj = with_prj,
>
>        with_c = with_c)
>
> 3: tryCatchList(expr, classes, parentenv, handlers)
>
> 2: tryCatch({
>
>        stopifnot(is.logical(plugin) || is.null(plugin))
>
>        stopifnot(is.logical(ignore.stderr))
>
>        if (missing(layer))
>
>            layer <- "1"
>
>        layer <- as.character(layer)
>
>        stopifnot(is.logical(with_c))
>
>        if (!is.null(driver) && driver == "GRASS")
>
>            plugin <- TRUE
>
>        if (!requireNamespace("rgdal", quietly = TRUE)) {
>
>            stop("rgdal not available")
>
>        }
>
>        if (is.null(plugin)) {
>
>            ogrD <- rgdal::ogrDrivers()$name
>
>            plugin <- "GRASS" %in% ogrD
>
>        }
>
>        if (plugin) {
>
>            res <- .read_vect_plugin(vname = vname, layer = layer,
>
>                type = type, ignore.stderr = ignore.stderr, pointDropZ =
> pointDropZ,
>
>                mapset = mapset)
>
>        }
>
>        else {
>
>            res <- .read_vect_non_plugin(vname = vname, layer = layer,
>
>                type = type, remove.duplicates = remove.duplicates,
>
>                ignore.stderr = ignore.stderr, pointDropZ = pointDropZ,
>
>                driver = driver, with_prj = with_prj, with_c = with_c)
>
>        }
>
>    }, finally = {
>
>        if (get.suppressEchoCmdInFuncOption()) {
>
>            tull <- set.echoCmdOption(inEchoCmd)
>
>        }
>
>    })
>
> 1: readVECT("archsites")
>
>
>
>
>
> This error does not show when using R instead of RStudio. I’ve searched
> around and tried to implement the fixes proposed for similar issues
> (unsuccessfully).  I feel that it might be a very simple issue, but I am
> stuck and I will appreciate any help. Here the Sys.getenv() and
> sessionInfo(), in case there are needed.
>
>
>
>
> > Sys.getenv()
>
> __COMPAT_LAYER              RunAsAdmin DetectorsWin7
>
> ADSK_CLM_WPAD_PROXY_CHECK   FALSE
>
> ALLUSERSPROFILE             C:\ProgramData
>
> APPDATA                     C:\Users\...\AppData\Roaming
>
> CLICOLOR_FORCE              1
>
> CommonProgramFiles          C:\Program Files\Common Files
>
> CommonProgramFiles(x86)     C:\Program Files (x86)\Common Files
>
> CommonProgramW6432          C:\Program Files\Common Files
>
> COMPUTERNAME
>
> ComSpec                     C:\WINDOWS\system32\cmd.exe
>
> DISPLAY                     :0
>
> DriverData                  C:\Windows\System32\Drivers\DriverData
>
> FP_NO_HOST_CHECK            NO
>
> GDAL_DATA                   C:/Program Files/R/R-3.5.1/library/rgdal/gdal
>
> GEODA_GDAL_DATA             C:\Program Files\GeoDa Software\data
>
> GEODA_OGR_DRIVER_PATH       C:\Program Files\GeoDa Software
>
> GFORTRAN_STDERR_UNIT        -1
>
> GFORTRAN_STDOUT_UNIT        -1
>
> GRASS_MESSAGE_FORMAT        text
>
> GRASS_PAGER                 cat
>
> HOME                        C:/Users/…/Documents
>
> HOMEDRIVE                   C:
>
> HOMEPATH                    \Users\...
>
> JRI_HOME
> C:\Users\...\Documents\R\win-library\3.4\rJava\jri
>
> LOCALAPPDATA                C:\Users\...\AppData\Local
>
> LOGONSERVER                 \\...
>
> MSYS2_ENV_CONV_EXCL         R_ARCH
>
> NUMBER_OF_PROCESSORS        8
>
> OneDrive                    C:\Users\...\OneDrive
>
> OS                          Windows_NT
>
> PATH                        C:\Program
>
>
> Files\R\R-3.5.1\bin\x64;C:\Rtools\bin;C:\ProgramData\Oracle\Java\javapath;c:\Rtools\gcc-4.6.3\bin;C:\Program
>
>                             Files (x86)\Intel\iCLS Client\;C:\Program
>
>                             Files\Intel\iCLS
>
>
> Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
>
>                             Files\Intel\Intel(R) Management Engine
>
>                             Components\DAL;C:\Program Files\Intel\Intel(R)
>
>                             Management Engine Components\IPT;C:\Program
> Files
>
>                             (x86)\Intel\Intel(R) Management Engine
>
>                             Components\DAL;C:\Program Files
> (x86)\Intel\Intel(R)
>
>                             Management Engine Components\IPT;C:\Program
> Files
>
>                             (x86)\ATI
> Technologies\ATI.ACE\Core-Static;C:\Program
>
>                             Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program
>
>                             Files\Git\cmd;C:\Program Files
>
>                             (x86)\Skype\Phone\;C:\Program
>
>                             Files\R\R-3.5.1\bin\x64;C:\Program
>
>
> Files\RStudio\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program
>
>                             Files (x86)\Calibre2\;C:\Program
>
>                             Files\Intel\WiFi\bin\;C:\Program Files\Common
>
>                             Files\Intel\WirelessCommon\;C:\Users\...
> \AppData\Local\Microsoft\WindowsApps
>
> PATHEXT
>  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
>
> PROCESSOR_ARCHITECTURE      AMD64
>
> PROCESSOR_IDENTIFIER        Intel64 Family 6 Model 60 Stepping 3,
> GenuineIntel
>
> PROCESSOR_LEVEL             6
>
> PROCESSOR_REVISION          3c03
>
> ProgramData                 C:\ProgramData
>
> ProgramFiles                C:\Program Files
>
> ProgramFiles(x86)           C:\Program Files (x86)
>
> ProgramW6432                C:\Program Files
>
> PROJ_LIB                    C:/Program Files/R/R-3.5.1/library/rgdal/proj
>
> PSModulePath
> C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
>
> PUBLIC                      C:\Users\Public
>
> R_ARCH                      /x64
>
> R_COMPILED_BY               gcc 4.9.3
>
> R_DOC_DIR                   C:/PROGRA~1/R/R-35~1.1/doc
>
> R_HOME                      C:/PROGRA~1/R/R-35~1.1
>
> R_LIBS_USER                 C:\Program Files\R\R-3.5.1\library
>
> R_MAP_DATA_DIR              C:/Program
> Files/R/R-3.5.1/library/maps/mapdata/
>
> R_MAP_DATA_DIR_WORLD        C:/Program
> Files/R/R-3.5.1/library/maps/mapdata/
>
> R_USER                      C:/Users/…/Documents
>
> RCRAN                       C:\Program Files\R\R-3.5.1\bin\x64
>
> RMARKDOWN_MATHJAX_PATH      C:/Program Files/RStudio/resources/mathjax-26
>
> RS_LOCAL_PEER               \\.\pipe\30976-rsession
>
> RS_RPOSTBACK_PATH           C:/Program Files/RStudio/bin/rpostback
>
> RS_SHARED_SECRET            63341846741
>
> RSTUDIO                     1
>
> RSTUDIO_CONSOLE_COLOR       256
>
> RSTUDIO_CONSOLE_WIDTH       80
>
> RSTUDIO_MSYS_SSH            C:/Program Files/RStudio/bin/msys-ssh-1000-18
>
> RSTUDIO_PANDOC              C:/Program Files/RStudio/bin/pandoc
>
> RSTUDIO_SESSION_PORT        30976
>
> RSTUDIO_USER_IDENTITY       …
>
> RSTUDIO_WINUTILS            C:/Program Files/RStudio/bin/winutils
>
> SystemDrive                 C:
>
> SystemRoot                  C:\WINDOWS
>
> TEMP                        C:\Users\...\AppData\Local\Temp
>
> TERM                        xterm-256color
>
> TMP                         C:\Users\...\AppData\Local\Temp
>
> USERDOMAIN                  …
>
> USERDOMAIN_ROAMINGPROFILE   …
>
> USERNAME                    …
>
> USERPROFILE                 C:\Users\...
>
> windir                      C:\WINDOWS
>
>
>
>
>
> > sessionInfo()
>
> R version 3.5.1 (2018-07-02)
>
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> Running under: Windows >= 8 x64 (build 9200)
>
>
>
> Matrix products: default
>
>
>
> locale:
>
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252
>
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
>
>
> [5] LC_TIME=English_United States.1252
>
>
>
> attached base packages:
>
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>
>
> other attached packages:
>
>  [1] dbscan_1.1-2        rgdal_1.3-4         geostatsp_1.7.2
>  Matrix_1.2-14
>
>  [5] raster_2.6-7        maptools_0.9-3      maps_3.3.0
> spatstat_1.56-1
>
>  [9] rpart_4.1-13        nlme_3.1-137        spatstat.data_1.3-1
> rgrass7_0.1-10
>
> [13] XML_3.98-1.16       sp_1.3-1
>
>
>
>
>
>
>
> Thanks in advance,
>
>
>
> William
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> --
Sarah Goslee (she/her)
http://www.sarahgoslee.com

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

error when trying to use RStudio within GRASS

Sun, 12/23/2018 - 06:44
Hi guys,

I have the following error when using Rstudio within GRASS 7.2.2 (stand-alone version) in Windows 10:



Location Spearfish_60

> points <- readVECT("archsites")

Error in if (get("SYS", envir = .GRASS_CACHE) == "WinNat" && nchar(WN_bat) ==  :

  missing value where TRUE/FALSE needed


> traceback()

7: parseGRASS(cmd, legacyExec = legacyExec)

6: doGRASS(cmd, flags = flags, ..., parameters = parameters, echoCmd = echoCmd,

       legacyExec = legacyExec)

5: execGRASS("v.in.ogr", flags = ifelse(ignore.stderr, c("f", "quiet"),

       "f"), intern = TRUE, ignore.stderr = ignore.stderr)

4: .read_vect_non_plugin(vname = vname, layer = layer, type = type,

       remove.duplicates = remove.duplicates, ignore.stderr = ignore.stderr,

       pointDropZ = pointDropZ, driver = driver, with_prj = with_prj,

       with_c = with_c)

3: tryCatchList(expr, classes, parentenv, handlers)

2: tryCatch({

       stopifnot(is.logical(plugin) || is.null(plugin))

       stopifnot(is.logical(ignore.stderr))

       if (missing(layer))

           layer <- "1"

       layer <- as.character(layer)

       stopifnot(is.logical(with_c))

       if (!is.null(driver) && driver == "GRASS")

           plugin <- TRUE

       if (!requireNamespace("rgdal", quietly = TRUE)) {

           stop("rgdal not available")

       }

       if (is.null(plugin)) {

           ogrD <- rgdal::ogrDrivers()$name

           plugin <- "GRASS" %in% ogrD

       }

       if (plugin) {

           res <- .read_vect_plugin(vname = vname, layer = layer,

               type = type, ignore.stderr = ignore.stderr, pointDropZ = pointDropZ,

               mapset = mapset)

       }

       else {

           res <- .read_vect_non_plugin(vname = vname, layer = layer,

               type = type, remove.duplicates = remove.duplicates,

               ignore.stderr = ignore.stderr, pointDropZ = pointDropZ,

               driver = driver, with_prj = with_prj, with_c = with_c)

       }

   }, finally = {

       if (get.suppressEchoCmdInFuncOption()) {

           tull <- set.echoCmdOption(inEchoCmd)

       }

   })

1: readVECT("archsites")

 

 

This error does not show when using R instead of RStudio. I’ve searched around and tried to implement the fixes proposed for similar issues (unsuccessfully).  I feel that it might be a very simple issue, but I am stuck and I will appreciate any help. Here the Sys.getenv() and sessionInfo(), in case there are needed.




> Sys.getenv()

__COMPAT_LAYER              RunAsAdmin DetectorsWin7

ADSK_CLM_WPAD_PROXY_CHECK   FALSE

ALLUSERSPROFILE             C:\ProgramData

APPDATA                     C:\Users\...\AppData\Roaming

CLICOLOR_FORCE              1

CommonProgramFiles          C:\Program Files\Common Files

CommonProgramFiles(x86)     C:\Program Files (x86)\Common Files

CommonProgramW6432          C:\Program Files\Common Files

COMPUTERNAME              

ComSpec                     C:\WINDOWS\system32\cmd.exe

DISPLAY                     :0

DriverData                  C:\Windows\System32\Drivers\DriverData

FP_NO_HOST_CHECK            NO

GDAL_DATA                   C:/Program Files/R/R-3.5.1/library/rgdal/gdal

GEODA_GDAL_DATA             C:\Program Files\GeoDa Software\data

GEODA_OGR_DRIVER_PATH       C:\Program Files\GeoDa Software

GFORTRAN_STDERR_UNIT        -1

GFORTRAN_STDOUT_UNIT        -1

GRASS_MESSAGE_FORMAT        text

GRASS_PAGER                 cat

HOME                        C:/Users/…/Documents

HOMEDRIVE                   C:

HOMEPATH                    \Users\...

JRI_HOME                    C:\Users\...\Documents\R\win-library\3.4\rJava\jri

LOCALAPPDATA                C:\Users\...\AppData\Local

LOGONSERVER                 \\...

MSYS2_ENV_CONV_EXCL         R_ARCH

NUMBER_OF_PROCESSORS        8

OneDrive                    C:\Users\...\OneDrive

OS                          Windows_NT

PATH                        C:\Program

                            Files\R\R-3.5.1\bin\x64;C:\Rtools\bin;C:\ProgramData\Oracle\Java\javapath;c:\Rtools\gcc-4.6.3\bin;C:\Program

                            Files (x86)\Intel\iCLS Client\;C:\Program

                            Files\Intel\iCLS

                            Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program

                            Files\Intel\Intel(R) Management Engine

                            Components\DAL;C:\Program Files\Intel\Intel(R)

                            Management Engine Components\IPT;C:\Program Files

                            (x86)\Intel\Intel(R) Management Engine

                            Components\DAL;C:\Program Files (x86)\Intel\Intel(R)

                            Management Engine Components\IPT;C:\Program Files

                            (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program

                            Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program

                            Files\Git\cmd;C:\Program Files

                            (x86)\Skype\Phone\;C:\Program

                            Files\R\R-3.5.1\bin\x64;C:\Program

                            Files\RStudio\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program

                            Files (x86)\Calibre2\;C:\Program

                            Files\Intel\WiFi\bin\;C:\Program Files\Common

                            Files\Intel\WirelessCommon\;C:\Users\... \AppData\Local\Microsoft\WindowsApps

PATHEXT                     .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

PROCESSOR_ARCHITECTURE      AMD64

PROCESSOR_IDENTIFIER        Intel64 Family 6 Model 60 Stepping 3, GenuineIntel

PROCESSOR_LEVEL             6

PROCESSOR_REVISION          3c03

ProgramData                 C:\ProgramData

ProgramFiles                C:\Program Files

ProgramFiles(x86)           C:\Program Files (x86)

ProgramW6432                C:\Program Files

PROJ_LIB                    C:/Program Files/R/R-3.5.1/library/rgdal/proj

PSModulePath                C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\

PUBLIC                      C:\Users\Public

R_ARCH                      /x64

R_COMPILED_BY               gcc 4.9.3

R_DOC_DIR                   C:/PROGRA~1/R/R-35~1.1/doc

R_HOME                      C:/PROGRA~1/R/R-35~1.1

R_LIBS_USER                 C:\Program Files\R\R-3.5.1\library

R_MAP_DATA_DIR              C:/Program Files/R/R-3.5.1/library/maps/mapdata/

R_MAP_DATA_DIR_WORLD        C:/Program Files/R/R-3.5.1/library/maps/mapdata/

R_USER                      C:/Users/…/Documents

RCRAN                       C:\Program Files\R\R-3.5.1\bin\x64

RMARKDOWN_MATHJAX_PATH      C:/Program Files/RStudio/resources/mathjax-26

RS_LOCAL_PEER               \\.\pipe\30976-rsession

RS_RPOSTBACK_PATH           C:/Program Files/RStudio/bin/rpostback

RS_SHARED_SECRET            63341846741

RSTUDIO                     1

RSTUDIO_CONSOLE_COLOR       256

RSTUDIO_CONSOLE_WIDTH       80

RSTUDIO_MSYS_SSH            C:/Program Files/RStudio/bin/msys-ssh-1000-18

RSTUDIO_PANDOC              C:/Program Files/RStudio/bin/pandoc

RSTUDIO_SESSION_PORT        30976

RSTUDIO_USER_IDENTITY       …

RSTUDIO_WINUTILS            C:/Program Files/RStudio/bin/winutils

SystemDrive                 C:

SystemRoot                  C:\WINDOWS

TEMP                        C:\Users\...\AppData\Local\Temp

TERM                        xterm-256color

TMP                         C:\Users\...\AppData\Local\Temp

USERDOMAIN                  …

USERDOMAIN_ROAMINGPROFILE   …

USERNAME                    …

USERPROFILE                 C:\Users\...

windir                      C:\WINDOWS

 

 

> sessionInfo()

R version 3.5.1 (2018-07-02)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows >= 8 x64 (build 9200)

 

Matrix products: default

 

locale:

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  

[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                        

[5] LC_TIME=English_United States.1252  

 

attached base packages:

[1] stats     graphics  grDevices utils     datasets  methods   base    

 

other attached packages:

 [1] dbscan_1.1-2        rgdal_1.3-4         geostatsp_1.7.2     Matrix_1.2-14    

 [5] raster_2.6-7        maptools_0.9-3      maps_3.3.0          spatstat_1.56-1  

 [9] rpart_4.1-13        nlme_3.1-137        spatstat.data_1.3-1 rgrass7_0.1-10    

[13] XML_3.98-1.16       sp_1.3-1          

 

 

 

Thanks in advance,

 

William
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: R Help

Fri, 12/21/2018 - 07:07
Dear Esu,

you can probably solve these tasks using sf package, which uses bit
different way of representing spatial objects compared to the sp object.
Below you'll find an example for the North Carolina dataset. Keep in mind
that calculating area and perimeter depends on your coordinate system (i.e.
you can use projection that works better for calculating areas, or
distances; check the area/perimeter columns in nc dataset versus the output
of the functions below).
Package lwgeom is for the st_perimeter() function, and I converted it to
equidistant projection, since st_perimeter() doesn't like lat/long data.
Spatial objects of sp class you can convert to simple feature using
st_as_sf() function.

Hope it helps,
Mirza.

library(sf)
library(lwgeom)

nc <- st_read(system.file("shape/nc.shp", package="sf"))
nc <- st_transform(nc, crs = "+proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0
+y_0=0 +a=6371007 +b=6371007 +units=m +no_defs")

my_area <- st_area(nc)
my_centroid_x = st_coordinates(st_centroid(nc))[, 1]
my_centroid_y = st_coordinates(st_centroid(nc))[, 2]
my_perimeter = st_perimeter(nc)

On Fri, Dec 21, 2018 at 1:34 PM Andres Diaz Loaiza <[hidden email]>
wrote:

> Dear Esu,
>
> About your question there is huge literature already written.
>
> I recommend to read the sp package manual.
>
> An example for extract the coordinates you can  find it here:
>
>
> https://gis.stackexchange.com/questions/43543/how-to-calculate-polygon-centroids-in-r-for-non-contiguous-shapes
>
> If you want to see how works the function remember that r is an open source
> code and you can find the original functions over the binaries repositories
> or compressed packages.
>
> All the best,
>
> Andres
>
>
> On Thu, 20 Dec 2018 at 22:58, Esu Esu via R-sig-Geo <
> [hidden email]>
> wrote:
>
> > Dear All,
> > I am new to R-programming. I have question if anyone can help me with:Q:
> > how can I create functions in R to compute the area (A), centroid (Cx and
> > Cy) and perimeter (P) of a polygon list .  I want to write R functions to
> > compute these quantities for individual polygons, as well asan overall
> > function to take a polygon list and return a data frame with four columns
> > and the samenumber of rows as polygons in the list.  Each quantity
> > should correspond to each column. it is (sp) class object.
> > Hope to find any suggestion or answer
> >  RegardsMuhsien
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
> --
> Andrés D.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
*Mirza Čengić*

*Junior Researcher | Department of Environmental Science*
Radboud University | Heyendaalseweg 135
6525 AJ Nijmegen | The Netherlands

+31 657020823 | +38761908392
Skype: mirzacengic
<https://www.linkedin.com/in/mirzacengic>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: R Help

Fri, 12/21/2018 - 06:33
Dear Esu,

About your question there is huge literature already written.

I recommend to read the sp package manual.

An example for extract the coordinates you can  find it here:

https://gis.stackexchange.com/questions/43543/how-to-calculate-polygon-centroids-in-r-for-non-contiguous-shapes

If you want to see how works the function remember that r is an open source
code and you can find the original functions over the binaries repositories
or compressed packages.

All the best,

Andres


On Thu, 20 Dec 2018 at 22:58, Esu Esu via R-sig-Geo <[hidden email]>
wrote:

> Dear All,
> I am new to R-programming. I have question if anyone can help me with:Q:
> how can I create functions in R to compute the area (A), centroid (Cx and
> Cy) and perimeter (P) of a polygon list .  I want to write R functions to
> compute these quantities for individual polygons, as well asan overall
> function to take a polygon list and return a data frame with four columns
> and the samenumber of rows as polygons in the list.  Each quantity
> should correspond to each column. it is (sp) class object.
> Hope to find any suggestion or answer
>  RegardsMuhsien
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> --
Andrés D.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: [FORGED] R Help

Thu, 12/20/2018 - 16:47

On 12/21/18 10:56 AM, Esu Esu via R-sig-Geo wrote:

> Dear All,
> I am new to R-programming.

Learn to crawl before you start trying to walk or run.  Study some of
the many R tutorials that are available.

> I have question if anyone can help me with:Q: how can I create functions in R to compute the area
> (A), centroid (Cx and Cy) and perimeter (P) of a polygon list .  I want to write R functions to
> compute these quantities for individual polygons, as well asan overall function to take a polygon
> list and return a data frame with four columns and the samenumber of rows as polygons in the list.
> Each quantity should correspond to each column. it is (sp) class object. > Hope to find any suggestion or answer

The spatstat package will enable you to do all this pretty easily.  See

     ?centroid.owin
     ?perimeter
     ?area.owin

You will need to convert your polygons to objects of class "owin".  The
as.owin() function should handle this for you.

cheers,

Rolf Turner


--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: R Help

Thu, 12/20/2018 - 16:08
Package rgeos is a good starting point.

Esu Esu via R-sig-Geo <[hidden email]> escreveu no dia quinta,
20/12/2018 à(s) 21:58:

> Dear All,
> I am new to R-programming. I have question if anyone can help me with:Q:
> how can I create functions in R to compute the area (A), centroid (Cx and
> Cy) and perimeter (P) of a polygon list .  I want to write R functions to
> compute these quantities for individual polygons, as well asan overall
> function to take a polygon list and return a data frame with four columns
> and the samenumber of rows as polygons in the list.  Each quantity
> should correspond to each column. it is (sp) class object.
> Hope to find any suggestion or answer
>  RegardsMuhsien
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

R Help

Thu, 12/20/2018 - 15:56
Dear All,
I am new to R-programming. I have question if anyone can help me with:Q: how can I create functions in R to compute the area (A), centroid (Cx and Cy) and perimeter (P) of a polygon list .  I want to write R functions to compute these quantities for individual polygons, as well asan overall function to take a polygon list and return a data frame with four columns and the samenumber of rows as polygons in the list.  Each quantity should correspond to each column. it is (sp) class object. 
Hope to find any suggestion or answer 
 RegardsMuhsien 
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: writeRaster: BSQ despite BIL is requested

Wed, 12/19/2018 - 07:45
Thanks Roger,

Just to summarize, not only the hdr files are correct, the hdr files
are consistent with the ordering in the data files:

require(rgdal)
require(raster)
m <- matrix(rep(10,20),ncol=5)
b <- brick(raster(m),raster(10*m),raster(100*m))
b
writeRaster(b, file="bwrast", format="ENVI", datatype="INT2U",
            bandorder="BIL", overwrite=TRUE)

writes a correct BSQ file, despite having requested BIL order

writeRaster(b, file="bwrast2", format="ENVI", datatype="INT2U",
            options="INTERLEAVE=BIL", overwrite=TRUE)

writes a correct BIL file (and this is a useful solution, thanks).

I tend to think that the fact that writeRaster() ignores
bandorder="BIL" is a bug.

Agus
(mi R is using Loaded GDAL runtime: GDAL 2.3.2, released 2018/09/21)

On Wed, Dec 19, 2018 at 11:52 AM Roger Bivand <[hidden email]> wrote:
>
> On Wed, 19 Dec 2018, Agustin Lobo wrote:
>
> > I do
> >
> > writeRaster(testin,
> > file="testin",format="ENVI",datatype="INT2U",bandorder="BIL",overwrite=TRUE)
> >
> > but get an image with BSQ order
> > (rda object: https://www.dropbox.com/s/or5h7yb9nd52e94/testin.rda?dl=0)
>
> Which version of GDAL is under all of this? It doesn't matter here, but
> might have mattered.
>
> raster::writeRaster() puts interleave = bsq in the *.hdr files. "BIP" and
> does not seem to do anything. However:
>
> writeGDAL(as(testin, "SpatialGridDataFrame"), fname="testinsp.envi",
> drivername="ENVI", type="UInt16", options="INTERLEAVE=BIL",
> setStatistics=TRUE)
>
> yields interleave = bil in the *.hdr file. Using the same route, I get:
>
> writeRaster(testin, file="testin", format="ENVI", datatype="INT2U",
> options="INTERLEAVE=BIL", overwrite=TRUE)
>
> with interleave = bil in the *.hdr file. I'm not sure where
> raster::writeRaster() drops the options definitions given in bandorder=,
> maybe ENVI is not a 'native' file format?
>
> Hope this helps,
>
> Roger
>
>
> > Thanks
> > Agus
> >
> > R version 3.5.0 (2018-04-23)
> > Platform: x86_64-pc-linux-gnu (64-bit)
> > Running under: Debian GNU/Linux buster/sid
> >
> > Matrix products: default
> > BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
> > LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
> >
> > locale:
> > [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
> > LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
> > LC_MONETARY=en_GB.UTF-8
> > [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C
> >               LC_ADDRESS=C               LC_TELEPHONE=C
> > [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
> >
> > attached base packages:
> > [1] stats     graphics  grDevices utils     datasets  methods   base
> >
> > other attached packages:
> > [1] raster_2.7-15 rgdal_1.3-6   sp_1.3-1
> >
> >
> > Agus
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; e-mail: [hidden email]
> https://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: writeRaster: BSQ despite BIL is requested

Wed, 12/19/2018 - 04:51
On Wed, 19 Dec 2018, Agustin Lobo wrote:

> I do
>
> writeRaster(testin,
> file="testin",format="ENVI",datatype="INT2U",bandorder="BIL",overwrite=TRUE)
>
> but get an image with BSQ order
> (rda object: https://www.dropbox.com/s/or5h7yb9nd52e94/testin.rda?dl=0)

Which version of GDAL is under all of this? It doesn't matter here, but
might have mattered.

raster::writeRaster() puts interleave = bsq in the *.hdr files. "BIP" and
does not seem to do anything. However:

writeGDAL(as(testin, "SpatialGridDataFrame"), fname="testinsp.envi",
drivername="ENVI", type="UInt16", options="INTERLEAVE=BIL",
setStatistics=TRUE)

yields interleave = bil in the *.hdr file. Using the same route, I get:

writeRaster(testin, file="testin", format="ENVI", datatype="INT2U",
options="INTERLEAVE=BIL", overwrite=TRUE)

with interleave = bil in the *.hdr file. I'm not sure where
raster::writeRaster() drops the options definitions given in bandorder=,
maybe ENVI is not a 'native' file format?

Hope this helps,

Roger


> Thanks
> Agus
>
> R version 3.5.0 (2018-04-23)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Debian GNU/Linux buster/sid
>
> Matrix products: default
> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
>
> locale:
> [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
> LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
> LC_MONETARY=en_GB.UTF-8
> [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C
>               LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] raster_2.7-15 rgdal_1.3-6   sp_1.3-1
>
>
> Agus
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

writeRaster: BSQ despite BIL is requested

Wed, 12/19/2018 - 02:56
I do

writeRaster(testin,
file="testin",format="ENVI",datatype="INT2U",bandorder="BIL",overwrite=TRUE)

but get an image with BSQ order
(rda object: https://www.dropbox.com/s/or5h7yb9nd52e94/testin.rda?dl=0)
Thanks
Agus

R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux buster/sid

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
LC_MONETARY=en_GB.UTF-8
 [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C
               LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] raster_2.7-15 rgdal_1.3-6   sp_1.3-1


Agus

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: clip a raster layer to a mask layer using raster algebra in R?

Mon, 12/10/2018 - 08:46
Thank you.

But the most expensive step is constructing the mask with NA values.

 >gebco_rsl[gebco < rsl] <- NA

The rest of the computations is quite fast indeed... Do you know a
faster alternative, for creating the mask, to the line above?

Best,
Christian

Am 09.12.18 um 09:59 schrieb obrl soil:
> Hello,
>
> in R you're working without the benefit of the GRASS 'region' concept
> for raster work (and all the hidden helper code that goes with it), so
> its never going to be a one liner - but the following may help.
>
> You can use raster algebra in R to do masking. Construct your mask so
> that the cells you want to keep are 0 and the cells you want to lose
> are NA.
>
> Then you can just add the raster and its mask together:
>
> masked_raster <- raster + mask
>
> because data + 0 = data, and data + NA = NA. This will still work even
> if the two rasters don't have the same extent, so long as they have
> the same cell size and alignment. The operation will throw a warning
> but will complete successfully, returning the intersection of the two
> objects. This should complete fairly quickly if the mask extent is
> small relative to the target dataset. Try using raster::trim() on the
> mask beforehand if it has a lot of whitespace.
>
> HTH
> @obrl_soil
>
> On Thu, Dec 6, 2018 at 6:38 PM Christian Willmes <[hidden email]> wrote:
>> Hello,
>>
>> this should be normally a very basic simple one-liner, but I can't get
>> my head around it. I only find solutions for cliping a raster against a
>> vector, but none for clipping a raster against a raster mask.
>>
>> I want to clip a layer to a mask. In GRASS GIS r.mapcalc the syntax is:
>>
>> result = if(RSLmask, gebco, null())
>>
>> This clips the GEBCO dataset to the extent of the given raster mask
>> 'rslmask'. The result raster has heigt values within the raster mask
>> extent, the rest of the raster layer has NULL or NA values.
>>
>> In R I did the following, but it does not work as expected:
>>
>> gebco <- raster(gebco2014) #load raster
>>
>> RSLmask <- gebco >= 0  #create mask layer
>>
>> RSL <- ifelse(RSLmask, 1, NA)
>>
>> The last command gives an error about vector type 'S4'?!
>>
>>   >In is.na(test) :
>>     >is.na() auf nicht-(Liste oder Vektor) des Typs 'S4' angewendet
>>
>> So, in short: what is the R way to simply clip a raster to a raster mask?
>>
>> Thanks and best regards,
>> Christian
>>
>> PS: If found many solutions for clipping a raster to a vector polygon,
>> but this is not what I want.
>>
>> --
>> Dr. Christian Willmes
>> AG GIS & Fernerkundung      | GIS & RS Group
>> Geographisches Institut     | Institute of Geography
>> Universität zu Köln         | University of Cologne
>> Tel.: +49 (0)221 470 6234
>> http://www.geographie.uni-koeln.de/14126.html
>> http://www.sfb806.de
>> http://crc806db.uni-koeln.de
>> http://publons.com/a/1316706/
>> http://orcid.org/0000-0002-5566-6542
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Dr. Christian Willmes
AG GIS & Fernerkundung      | GIS & RS Group
Geographisches Institut     | Institute of Geography
Universität zu Köln         | University of Cologne
Tel.: +49 (0)221 470 6234
http://www.geographie.uni-koeln.de/14126.html
http://www.sfb806.de
http://crc806db.uni-koeln.de
http://publons.com/a/1316706/
http://orcid.org/0000-0002-5566-6542

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: clip a raster layer to a mask layer using raster algebra in R?

Sun, 12/09/2018 - 02:59
Hello,

in R you're working without the benefit of the GRASS 'region' concept
for raster work (and all the hidden helper code that goes with it), so
its never going to be a one liner - but the following may help.

You can use raster algebra in R to do masking. Construct your mask so
that the cells you want to keep are 0 and the cells you want to lose
are NA.

Then you can just add the raster and its mask together:

masked_raster <- raster + mask

because data + 0 = data, and data + NA = NA. This will still work even
if the two rasters don't have the same extent, so long as they have
the same cell size and alignment. The operation will throw a warning
but will complete successfully, returning the intersection of the two
objects. This should complete fairly quickly if the mask extent is
small relative to the target dataset. Try using raster::trim() on the
mask beforehand if it has a lot of whitespace.

HTH
@obrl_soil

On Thu, Dec 6, 2018 at 6:38 PM Christian Willmes <[hidden email]> wrote:
>
> Hello,
>
> this should be normally a very basic simple one-liner, but I can't get
> my head around it. I only find solutions for cliping a raster against a
> vector, but none for clipping a raster against a raster mask.
>
> I want to clip a layer to a mask. In GRASS GIS r.mapcalc the syntax is:
>
> result = if(RSLmask, gebco, null())
>
> This clips the GEBCO dataset to the extent of the given raster mask
> 'rslmask'. The result raster has heigt values within the raster mask
> extent, the rest of the raster layer has NULL or NA values.
>
> In R I did the following, but it does not work as expected:
>
> gebco <- raster(gebco2014) #load raster
>
> RSLmask <- gebco >= 0  #create mask layer
>
> RSL <- ifelse(RSLmask, 1, NA)
>
> The last command gives an error about vector type 'S4'?!
>
>  >In is.na(test) :
>    >is.na() auf nicht-(Liste oder Vektor) des Typs 'S4' angewendet
>
> So, in short: what is the R way to simply clip a raster to a raster mask?
>
> Thanks and best regards,
> Christian
>
> PS: If found many solutions for clipping a raster to a vector polygon,
> but this is not what I want.
>
> --
> Dr. Christian Willmes
> AG GIS & Fernerkundung      | GIS & RS Group
> Geographisches Institut     | Institute of Geography
> Universität zu Köln         | University of Cologne
> Tel.: +49 (0)221 470 6234
> http://www.geographie.uni-koeln.de/14126.html
> http://www.sfb806.de
> http://crc806db.uni-koeln.de
> http://publons.com/a/1316706/
> http://orcid.org/0000-0002-5566-6542
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: clip a raster layer to a mask layer using raster algebra in R?

Thu, 12/06/2018 - 07:22
Possibly there are alternatives, like exploring raster::overlay together
with raster:clusterR
Hugo

Christian Willmes <[hidden email]> escreveu no dia quinta,
6/12/2018 à(s) 13:34:

> Thank you.
>
> It seems that both approaches need an additional, very expensive
> computation (takes several minutes on a i7-4790 with SSD) to create the
> mask or the extent, and in my case the mask computed by this command
> below is already what I want. Only values above a given RSL (Sealevel)
> height. The rest of the raster needs to be NA or NULL.
>
>  >gebco_rsl <- gebco
>  >gebco_rsl[gebco < rsl] <- NA
>
> ....
>
> The easy (and faster) approach for creating a mask:
>
>  >gebco_mask <- gebco >= rsl
>
> writes 0's into the remaining cells, which does not work for me (and the
> mask() function).
>
> On the other hand, the GRASS mapcalc computation (given below) takes
> less than a minute on that same raster.
>
> I wanted to re-implement the whole analysis in R for better/easier
> reproducibility, but now I think I will stick to R + GRASS GIS.
>
> If anyone knows a faster approach for creating a mask in R, please let
> me know.
>
> Thanks and best regards,
> Christian
>
> Am 06.12.18 um 10:59 schrieb Bede-Fazekas Ákos:
> > Dear Christian,
> > raster::mask() and raster::crop() may solve your problem.
> >
> https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/mask
> >
> https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/crop
> >
> > HTH,
> > Ákos Bede-Fazekas
> > Hungarian Academy of Sciences
> >
> > 2018.12.06. 9:40 keltezéssel, Christian Willmes írta:
> >> Sorry, I had an error in the main command.
> >>
> >> It should be:
> >>
> >> gebco_clipped <- ifelse(RSLmask, gebco, NA)
> >>
> >> But it still gives the same error.
> >>
> >> Best,
> >> Christian
> >>
> >> Am 06.12.18 um 09:37 schrieb Christian Willmes:
> >>> Hello,
> >>>
> >>> this should be normally a very basic simple one-liner, but I can't
> >>> get my head around it. I only find solutions for cliping a raster
> >>> against a vector, but none for clipping a raster against a raster mask.
> >>>
> >>> I want to clip a layer to a mask. In GRASS GIS r.mapcalc the syntax is:
> >>>
> >>> result = if(RSLmask, gebco, null())
> >>>
> >>> This clips the GEBCO dataset to the extent of the given raster mask
> >>> 'rslmask'. The result raster has heigt values within the raster mask
> >>> extent, the rest of the raster layer has NULL or NA values.
> >>>
> >>> In R I did the following, but it does not work as expected:
> >>>
> >>> gebco <- raster(gebco2014) #load raster
> >>>
> >>> RSLmask <- gebco >= 0  #create mask layer
> >>>
> >>> RSL <- ifelse(RSLmask, 1, NA)
> >>>
> >>> The last command gives an error about vector type 'S4'?!
> >>>
> >>> >In is.na(test) :
> >>>   >is.na() auf nicht-(Liste oder Vektor) des Typs 'S4' angewendet
> >>>
> >>> So, in short: what is the R way to simply clip a raster to a raster
> >>> mask?
> >>>
> >>> Thanks and best regards,
> >>> Christian
> >>>
> >>> PS: If found many solutions for clipping a raster to a vector
> >>> polygon, but this is not what I want.
> >>>
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> --
> Dr. Christian Willmes
> AG GIS & Fernerkundung      | GIS & RS Group
> Geographisches Institut     | Institute of Geography
> Universität zu Köln         | University of Cologne
> Tel.: +49 (0)221 470 6234
> http://www.geographie.uni-koeln.de/14126.html
> http://www.sfb806.de
> http://crc806db.uni-koeln.de
> http://publons.com/a/1316706/
> http://orcid.org/0000-0002-5566-6542
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: clip a raster layer to a mask layer using raster algebra in R?

Thu, 12/06/2018 - 06:33
Thank you.

It seems that both approaches need an additional, very expensive
computation (takes several minutes on a i7-4790 with SSD) to create the
mask or the extent, and in my case the mask computed by this command
below is already what I want. Only values above a given RSL (Sealevel)
height. The rest of the raster needs to be NA or NULL.

 >gebco_rsl <- gebco
 >gebco_rsl[gebco < rsl] <- NA

....

The easy (and faster) approach for creating a mask:

 >gebco_mask <- gebco >= rsl

writes 0's into the remaining cells, which does not work for me (and the
mask() function).

On the other hand, the GRASS mapcalc computation (given below) takes
less than a minute on that same raster.

I wanted to re-implement the whole analysis in R for better/easier
reproducibility, but now I think I will stick to R + GRASS GIS.

If anyone knows a faster approach for creating a mask in R, please let
me know.

Thanks and best regards,
Christian

Am 06.12.18 um 10:59 schrieb Bede-Fazekas Ákos:
> Dear Christian,
> raster::mask() and raster::crop() may solve your problem.
> https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/mask
> https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/crop
>
> HTH,
> Ákos Bede-Fazekas
> Hungarian Academy of Sciences
>
> 2018.12.06. 9:40 keltezéssel, Christian Willmes írta:
>> Sorry, I had an error in the main command.
>>
>> It should be:
>>
>> gebco_clipped <- ifelse(RSLmask, gebco, NA)
>>
>> But it still gives the same error.
>>
>> Best,
>> Christian
>>
>> Am 06.12.18 um 09:37 schrieb Christian Willmes:
>>> Hello,
>>>
>>> this should be normally a very basic simple one-liner, but I can't
>>> get my head around it. I only find solutions for cliping a raster
>>> against a vector, but none for clipping a raster against a raster mask.
>>>
>>> I want to clip a layer to a mask. In GRASS GIS r.mapcalc the syntax is:
>>>
>>> result = if(RSLmask, gebco, null())
>>>
>>> This clips the GEBCO dataset to the extent of the given raster mask
>>> 'rslmask'. The result raster has heigt values within the raster mask
>>> extent, the rest of the raster layer has NULL or NA values.
>>>
>>> In R I did the following, but it does not work as expected:
>>>
>>> gebco <- raster(gebco2014) #load raster
>>>
>>> RSLmask <- gebco >= 0  #create mask layer
>>>
>>> RSL <- ifelse(RSLmask, 1, NA)
>>>
>>> The last command gives an error about vector type 'S4'?!
>>>
>>> >In is.na(test) :
>>>   >is.na() auf nicht-(Liste oder Vektor) des Typs 'S4' angewendet
>>>
>>> So, in short: what is the R way to simply clip a raster to a raster
>>> mask?
>>>
>>> Thanks and best regards,
>>> Christian
>>>
>>> PS: If found many solutions for clipping a raster to a vector
>>> polygon, but this is not what I want.
>>>
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Dr. Christian Willmes
AG GIS & Fernerkundung      | GIS & RS Group
Geographisches Institut     | Institute of Geography
Universität zu Köln         | University of Cologne
Tel.: +49 (0)221 470 6234
http://www.geographie.uni-koeln.de/14126.html
http://www.sfb806.de
http://crc806db.uni-koeln.de
http://publons.com/a/1316706/
http://orcid.org/0000-0002-5566-6542

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: clip a raster layer to a mask layer using raster algebra in R?

Thu, 12/06/2018 - 03:59
Dear Christian,
raster::mask() and raster::crop() may solve your problem.
https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/mask
https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/crop

HTH,
Ákos Bede-Fazekas
Hungarian Academy of Sciences

2018.12.06. 9:40 keltezéssel, Christian Willmes írta:
> Sorry, I had an error in the main command.
>
> It should be:
>
> gebco_clipped <- ifelse(RSLmask, gebco, NA)
>
> But it still gives the same error.
>
> Best,
> Christian
>
> Am 06.12.18 um 09:37 schrieb Christian Willmes:
>> Hello,
>>
>> this should be normally a very basic simple one-liner, but I can't
>> get my head around it. I only find solutions for cliping a raster
>> against a vector, but none for clipping a raster against a raster mask.
>>
>> I want to clip a layer to a mask. In GRASS GIS r.mapcalc the syntax is:
>>
>> result = if(RSLmask, gebco, null())
>>
>> This clips the GEBCO dataset to the extent of the given raster mask
>> 'rslmask'. The result raster has heigt values within the raster mask
>> extent, the rest of the raster layer has NULL or NA values.
>>
>> In R I did the following, but it does not work as expected:
>>
>> gebco <- raster(gebco2014) #load raster
>>
>> RSLmask <- gebco >= 0  #create mask layer
>>
>> RSL <- ifelse(RSLmask, 1, NA)
>>
>> The last command gives an error about vector type 'S4'?!
>>
>> >In is.na(test) :
>>   >is.na() auf nicht-(Liste oder Vektor) des Typs 'S4' angewendet
>>
>> So, in short: what is the R way to simply clip a raster to a raster
>> mask?
>>
>> Thanks and best regards,
>> Christian
>>
>> PS: If found many solutions for clipping a raster to a vector
>> polygon, but this is not what I want.
>>
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: clip a raster layer to a mask layer using raster algebra in R?

Thu, 12/06/2018 - 02:40
Sorry, I had an error in the main command.

It should be:

gebco_clipped <- ifelse(RSLmask, gebco, NA)

But it still gives the same error.

Best,
Christian

Am 06.12.18 um 09:37 schrieb Christian Willmes:
> Hello,
>
> this should be normally a very basic simple one-liner, but I can't get
> my head around it. I only find solutions for cliping a raster against
> a vector, but none for clipping a raster against a raster mask.
>
> I want to clip a layer to a mask. In GRASS GIS r.mapcalc the syntax is:
>
> result = if(RSLmask, gebco, null())
>
> This clips the GEBCO dataset to the extent of the given raster mask
> 'rslmask'. The result raster has heigt values within the raster mask
> extent, the rest of the raster layer has NULL or NA values.
>
> In R I did the following, but it does not work as expected:
>
> gebco <- raster(gebco2014) #load raster
>
> RSLmask <- gebco >= 0  #create mask layer
>
> RSL <- ifelse(RSLmask, 1, NA)
>
> The last command gives an error about vector type 'S4'?!
>
> >In is.na(test) :
>   >is.na() auf nicht-(Liste oder Vektor) des Typs 'S4' angewendet
>
> So, in short: what is the R way to simply clip a raster to a raster mask?
>
> Thanks and best regards,
> Christian
>
> PS: If found many solutions for clipping a raster to a vector polygon,
> but this is not what I want.
> --
Dr. Christian Willmes
AG GIS & Fernerkundung      | GIS & RS Group
Geographisches Institut     | Institute of Geography
Universität zu Köln         | University of Cologne
Tel.: +49 (0)221 470 6234
http://www.geographie.uni-koeln.de/14126.html
http://www.sfb806.de
http://crc806db.uni-koeln.de
http://publons.com/a/1316706/
http://orcid.org/0000-0002-5566-6542

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

clip a raster layer to a mask layer using raster algebra in R?

Thu, 12/06/2018 - 02:37
Hello,

this should be normally a very basic simple one-liner, but I can't get
my head around it. I only find solutions for cliping a raster against a
vector, but none for clipping a raster against a raster mask.

I want to clip a layer to a mask. In GRASS GIS r.mapcalc the syntax is:

result = if(RSLmask, gebco, null())

This clips the GEBCO dataset to the extent of the given raster mask
'rslmask'. The result raster has heigt values within the raster mask
extent, the rest of the raster layer has NULL or NA values.

In R I did the following, but it does not work as expected:

gebco <- raster(gebco2014) #load raster

RSLmask <- gebco >= 0  #create mask layer

RSL <- ifelse(RSLmask, 1, NA)

The last command gives an error about vector type 'S4'?!

 >In is.na(test) :
   >is.na() auf nicht-(Liste oder Vektor) des Typs 'S4' angewendet

So, in short: what is the R way to simply clip a raster to a raster mask?

Thanks and best regards,
Christian

PS: If found many solutions for clipping a raster to a vector polygon,
but this is not what I want.

--
Dr. Christian Willmes
AG GIS & Fernerkundung      | GIS & RS Group
Geographisches Institut     | Institute of Geography
Universität zu Köln         | University of Cologne
Tel.: +49 (0)221 470 6234
http://www.geographie.uni-koeln.de/14126.html
http://www.sfb806.de
http://crc806db.uni-koeln.de
http://publons.com/a/1316706/
http://orcid.org/0000-0002-5566-6542

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: How to test for a layer in GRASS GIS mapset using rgrass7

Wed, 12/05/2018 - 02:24

Am 04.12.18 um 20:55 schrieb Roger Bivand:
> You need to wrap the test in try() if it may not succeed (in nc):
>
> oo <- try(execGRASS("g.findfile", element="cell", file="slope",
>       mapset="'.'", intern=TRUE), silent=TRUE)
> ifelse(class(oo) == "try-error", FALSE, TRUE)
>
> and use intern to capture the output if the file exists.

Thank you very much, this was exactly what solved the issue.

Best regards,
Christian



--
Dr. Christian Willmes
AG GIS & Fernerkundung      | GIS & RS Group
Geographisches Institut     | Institute of Geography
Universität zu Köln         | University of Cologne
Tel.: +49 (0)221 470 6234
http://www.geographie.uni-koeln.de/14126.html
http://www.sfb806.de
http://crc806db.uni-koeln.de
http://publons.com/a/1316706/
http://orcid.org/0000-0002-5566-6542

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: How to test for a layer in GRASS GIS mapset using rgrass7

Tue, 12/04/2018 - 15:42

On 12/4/18 5:42 PM, Christian Willmes wrote:
Hello,

I am not sure if this is the correct list to ask this specific question about executing GRASS GIS from R Scripts.

My problem is how to determine if a layer exists in the current GRASS GIS mapset or not.

During my script I use r.mapcalc from GRASS GIS to do some expensive computation. So I want to store and reuse the resulting layer, wich is produced according to a variable value, in case I need this layer for the specific variable value again.

If I just omit the overwrite tag it does not work, becasue GRASS GIS stops the execution on this event.

Error in execGRASS("r.mapcalc", expression = expr) : The command:
r.mapcalc expression="rsl40 = GEBCO_2014_2D_4326 >= -40"
produced an error (1) during execution:
FEHLER: output map <rsl40> exists. To overwrite, use the --overwrite flag
Error in execGRASS("r.mapcalc", expression = expr) : The command:
r.mapcalc expression="land_NA_1_rsl40  =  if( rsl40 , 1 ,null())"
produced an error (1) during execution:
FEHLER: output map <land_NA_1_rsl40> exists. To overwrite, use the
        --overwrite flag

So, I tryed to check if a certain layer already exists in the mapset to test if the computation needs/can be executed or not.

Using the following:

if(execGRASS("g.findfile", element="cell", file=lyrname, mapset='"."')){
    return(FALSE)
  }else{
    return(TRUE)
  }

Here it stops, if the layer does not exist:

Fehler in execGRASS("g.findfile", element = "cell", file = lyrname, mapset = "\".\"") :
  The command:
g.findfile element=cell file=rsl40 mapset="."
produced an error (1) during execution:


I think that the mapset parameter requires the actual mapset name, *not* the current working directory.




Does anyone know a solution to this?

Thank you very much!

Best,
Christian


-- Micha Silver Ben Gurion Univ. Sde Boker, Remote Sensing Lab cell: +972-523-665918
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Pages