Cannot read raster or vector maps from GRASS within R

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot read raster or vector maps from GRASS within R

Veronica Andreo
Hi

I'm trying to read raster and vector maps from GRASS (located in my grassdata) into R as I used to do until last month, but I'm getting the following error:

> library(rgrass7)
Loading required package: XML
GRASS GIS interface loaded with GRASS version: GRASS 7.8.1dev (2019)
and location: nc_basic_spm_grass7
> use_sf()
> v <- readVECT(roadsmajor)
Error in doGRASS(cmd, flags = flags, ..., parameters = parameters, echoCmd = echoCmd,  :
  object 'roadsmajor' not found
> execGRASS("g.list", parameters=list(type="vector"))
hospitals
nc_state
points_of_interest
railroads
roadsmajor <-- it is there
schools

I tested with grass76 and 78 in case it could be some python issue (76 is python 2 and 78 is python 3), but I'm getting the same error with both GRASS versions.

Has anything changed since september? This worked at the opengeohub summer school.

I paste the session info below. Thanks in advance for any help :)

Vero


---
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 30 (Thirty)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8  
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C      

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

other attached packages:
[1] rgrass7_0.2-1 XML_3.98-1.20

loaded via a namespace (and not attached):
 [1] tidyselect_0.2.5   purrr_0.3.2        reshape2_1.4.3     sf_0.8-0          
 [5] splines_3.6.1      lattice_0.20-38    colorspace_1.4-1   generics_0.0.2    
 [9] stars_0.3-1        stats4_3.6.1       survival_2.44-1.1  prodlim_2018.04.18
[13] rlang_0.4.0        ModelMetrics_1.2.2 e1071_1.7-2        pillar_1.4.2      
[17] glue_1.3.1         withr_2.1.2        DBI_1.0.0          foreach_1.4.7    
[21] plyr_1.8.4         lava_1.6.6         stringr_1.4.0      timeDate_3043.102
[25] munsell_0.5.0      gtable_0.3.0       recipes_0.1.7      codetools_0.2-16  
[29] caret_6.0-84       parallel_3.6.1     class_7.3-15       Rcpp_1.0.2        
[33] KernSmooth_2.23-15 scales_1.0.0       classInt_0.4-1     ipred_0.9-9      
[37] abind_1.4-5        ggplot2_3.2.1      stringi_1.4.3      dplyr_0.8.3      
[41] grid_3.6.1         tools_3.6.1        magrittr_1.5       lazyeval_0.2.2    
[45] tibble_2.1.3       crayon_1.3.4       pkgconfig_2.0.3    MASS_7.3-51.4    
[49] Matrix_1.2-17      data.table_1.12.2  lubridate_1.7.4    gower_0.2.1      
[53] assertthat_0.2.1   iterators_1.0.12   R6_2.4.0           rpart_4.1-15      
[57] units_0.6-4        nnet_7.3-12        nlme_3.1-140       compiler_3.6.1


_______________________________________________
grass-stats mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-stats
Reply | Threaded
Open this post in threaded view
|

Re: Cannot read raster or vector maps from GRASS within R

Roger Bivand
On Wed, 23 Oct 2019, Veronica Andreo wrote:

> Hi
>
> I'm trying to read raster and vector maps from GRASS (located in my
> grassdata) into R as I used to do until last month, but I'm getting the
> following error:
>
>> library(rgrass7)
> Loading required package: XML
> GRASS GIS interface loaded with GRASS version: GRASS 7.8.1dev (2019)
> and location: nc_basic_spm_grass7
>> use_sf()
>> v <- readVECT(roadsmajor)
> Error in doGRASS(cmd, flags = flags, ..., parameters = parameters, echoCmd
> = echoCmd,  :
>  object 'roadsmajor' not found

v <- readVECT("roadsmajor")
# maybe - it isn't an object in the R workspace

Roger

>> execGRASS("g.list", parameters=list(type="vector"))
> hospitals
> nc_state
> points_of_interest
> railroads
> roadsmajor <-- it is there
> schools
>
> I tested with grass76 and 78 in case it could be some python issue (76 is
> python 2 and 78 is python 3), but I'm getting the same error with both
> GRASS versions.
>
> Has anything changed since september? This worked at the opengeohub summer
> school.
>
> I paste the session info below. Thanks in advance for any help :)
>
> Vero
>
>
> ---
> sessionInfo()
> R version 3.6.1 (2019-07-05)
> Platform: x86_64-redhat-linux-gnu (64-bit)
> Running under: Fedora 30 (Thirty)
>
> Matrix products: default
> BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
> [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] rgrass7_0.2-1 XML_3.98-1.20
>
> loaded via a namespace (and not attached):
> [1] tidyselect_0.2.5   purrr_0.3.2        reshape2_1.4.3     sf_0.8-0
>
> [5] splines_3.6.1      lattice_0.20-38    colorspace_1.4-1
> generics_0.0.2
> [9] stars_0.3-1        stats4_3.6.1       survival_2.44-1.1
> prodlim_2018.04.18
> [13] rlang_0.4.0        ModelMetrics_1.2.2 e1071_1.7-2        pillar_1.4.2
>
> [17] glue_1.3.1         withr_2.1.2        DBI_1.0.0          foreach_1.4.7
>
> [21] plyr_1.8.4         lava_1.6.6         stringr_1.4.0
> timeDate_3043.102
> [25] munsell_0.5.0      gtable_0.3.0       recipes_0.1.7
> codetools_0.2-16
> [29] caret_6.0-84       parallel_3.6.1     class_7.3-15       Rcpp_1.0.2
>
> [33] KernSmooth_2.23-15 scales_1.0.0       classInt_0.4-1     ipred_0.9-9
>
> [37] abind_1.4-5        ggplot2_3.2.1      stringi_1.4.3      dplyr_0.8.3
>
> [41] grid_3.6.1         tools_3.6.1        magrittr_1.5
> lazyeval_0.2.2
> [45] tibble_2.1.3       crayon_1.3.4       pkgconfig_2.0.3    MASS_7.3-51.4
>
> [49] Matrix_1.2-17      data.table_1.12.2  lubridate_1.7.4    gower_0.2.1
>
> [53] assertthat_0.2.1   iterators_1.0.12   R6_2.4.0           rpart_4.1-15
>
> [57] units_0.6-4        nnet_7.3-12        nlme_3.1-140
> compiler_3.6.1
>

--
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
_______________________________________________
grass-stats mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-stats
Roger Bivand
NHH Norwegian School of Economics, Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: Cannot read raster or vector maps from GRASS within R

Veronica Andreo
Thanks Roger!
I just tried that and was about to write again saying "dismiss my previous email" but you were faster! :)

El mié., 23 oct. 2019 a las 14:36, Roger Bivand (<[hidden email]>) escribió:
On Wed, 23 Oct 2019, Veronica Andreo wrote:

> Hi
>
> I'm trying to read raster and vector maps from GRASS (located in my
> grassdata) into R as I used to do until last month, but I'm getting the
> following error:
>
>> library(rgrass7)
> Loading required package: XML
> GRASS GIS interface loaded with GRASS version: GRASS 7.8.1dev (2019)
> and location: nc_basic_spm_grass7
>> use_sf()
>> v <- readVECT(roadsmajor)
> Error in doGRASS(cmd, flags = flags, ..., parameters = parameters, echoCmd
> = echoCmd,  :
>  object 'roadsmajor' not found

v <- readVECT("roadsmajor")
# maybe - it isn't an object in the R workspace

Roger

>> execGRASS("g.list", parameters=list(type="vector"))
> hospitals
> nc_state
> points_of_interest
> railroads
> roadsmajor <-- it is there
> schools
>
> I tested with grass76 and 78 in case it could be some python issue (76 is
> python 2 and 78 is python 3), but I'm getting the same error with both
> GRASS versions.
>
> Has anything changed since september? This worked at the opengeohub summer
> school.
>
> I paste the session info below. Thanks in advance for any help :)
>
> Vero
>
>
> ---
> sessionInfo()
> R version 3.6.1 (2019-07-05)
> Platform: x86_64-redhat-linux-gnu (64-bit)
> Running under: Fedora 30 (Thirty)
>
> Matrix products: default
> BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
> [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] rgrass7_0.2-1 XML_3.98-1.20
>
> loaded via a namespace (and not attached):
> [1] tidyselect_0.2.5   purrr_0.3.2        reshape2_1.4.3     sf_0.8-0
>
> [5] splines_3.6.1      lattice_0.20-38    colorspace_1.4-1
> generics_0.0.2
> [9] stars_0.3-1        stats4_3.6.1       survival_2.44-1.1
> prodlim_2018.04.18
> [13] rlang_0.4.0        ModelMetrics_1.2.2 e1071_1.7-2        pillar_1.4.2
>
> [17] glue_1.3.1         withr_2.1.2        DBI_1.0.0          foreach_1.4.7
>
> [21] plyr_1.8.4         lava_1.6.6         stringr_1.4.0
> timeDate_3043.102
> [25] munsell_0.5.0      gtable_0.3.0       recipes_0.1.7
> codetools_0.2-16
> [29] caret_6.0-84       parallel_3.6.1     class_7.3-15       Rcpp_1.0.2
>
> [33] KernSmooth_2.23-15 scales_1.0.0       classInt_0.4-1     ipred_0.9-9
>
> [37] abind_1.4-5        ggplot2_3.2.1      stringi_1.4.3      dplyr_0.8.3
>
> [41] grid_3.6.1         tools_3.6.1        magrittr_1.5
> lazyeval_0.2.2
> [45] tibble_2.1.3       crayon_1.3.4       pkgconfig_2.0.3    MASS_7.3-51.4
>
> [49] Matrix_1.2-17      data.table_1.12.2  lubridate_1.7.4    gower_0.2.1
>
> [53] assertthat_0.2.1   iterators_1.0.12   R6_2.4.0           rpart_4.1-15
>
> [57] units_0.6-4        nnet_7.3-12        nlme_3.1-140
> compiler_3.6.1
>

--
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

_______________________________________________
grass-stats mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-stats