1

I used the command readRAST (rgrass7) to get maps into R. Now, it does not work. I tried several options with 0 result. Updated all R packages. Installed GRASS 7.8.5. Started Rgui within GRASS. Getting

    elev <- readRAST("elevation", ignore.stderr=TRUE)
    Error in sp::CRS(getLocationProj()) : NA

I still can get vector maps via readVECT with no issues.

Is there any way to fix it? If not, what is the current method to get GRASS raster maps into R?

Thank you.

#===============

R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

During startup - Warning messages:
1: Setting LC_CTYPE=en_AU.cp1252 failed
2: Setting LC_COLLATE=en_AU.cp1252 failed
3: Setting LC_TIME=en_AU.cp1252 failed
4: Setting LC_MONETARY=en_AU.cp1252 failed
    library(sp)
    library(rgrass7)
    Loading required package: XML
    GRASS GIS interface loaded with GRASS version: GRASS 7.8.5 (2020)
    and location: nc_spm_08_grass7
    library(rgdal)
    rgdal: version: 1.5-23, (SVN revision 1121)
    Geospatial Data Abstraction Library extensions to R successfully loaded
    Loaded GDAL runtime: GDAL 3.2.1, released 2020/12/29
    Path to GDAL shared files: C:/Users/andrew/Documents/R/win-library/4.0/rgdal/gdal
    GDAL binary built with GEOS: TRUE
    Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
    Path to PROJ shared files: C:/Users/andrew/Documents/R/win-library/4.0/rgdal/proj
    PROJ CDN enabled: FALSE
    Linking to sp version:1.4-5
    To mute warnings of possible GDAL/OSR exportToProj4() degradation,
    use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
    Overwritten PROJ_LIB was C:/Users/andrew/Documents/R/win-library/4.0/rgdal/proj
    gmeta()
    gisdbase C:\andrew\GISDATABASE
    location nc_spm_08_grass7
    mapset PERMANENT
    rows 280
    columns 767
    north 307000
    south 27000
    west 151000
    east 918000
    nsres 1000
    ewres 1000
    use_sp()

    sessionInfo()
    R version 4.0.5 (2021-03-31)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows 10 x64 (build 18363)


    Matrix products: default
    
    locale:
    [1] LC_COLLATE=C LC_CTYPE=English_Australia.1252
    [3] LC_MONETARY=C LC_NUMERIC=C
    [5] LC_TIME=C
    
    attached base packages:
    [1] stats graphics grDevices utils datasets methods base
    
    other attached packages:
    [1] rgdal_1.5-23 rgrass7_0.2-6 XML_3.99-0.6 sp_1.4-5
    
    loaded via a namespace (and not attached):
    [1] compiler_4.0.5 grid_4.0.5 lattice_0.20-41
    > elev <- readRAST("elevation", ignore.stderr=TRUE)
    Error in sp::CRS(getLocationProj()) : NA
Andrew Olenko
  • 31
  • 1
  • 2
  • You can use `raster` package to read rasters like `raster("filename.extension")`. – UseR10085 Apr 09 '21 at 09:57
  • The question was not about reading just raster filename.extension, it was about proper reading raster files that are parts of GRASS (with all included information). – Andrew Olenko Apr 10 '21 at 04:40

1 Answers1

0

The developer of rgrass7 answered here github.com/rsbivand/rgrass7/issues/27 and suggested the way to fix this issue now. It will be fixed in the future release of rgrass7

Andrew Olenko
  • 31
  • 1
  • 2