rsbivand / rgrass

Interpreted interface between the GRASS geographical information system and R
https://rsbivand.github.io/rgrass/
24 stars 8 forks source link

initGRASS(), execGRASS(), write/readVECT() do not work when running the second time #13

Closed lovalery closed 4 years ago

lovalery commented 4 years ago

@rsbivand Dear Roger, As agreed, I report my use case of 'rgrass7' where R returns error messages.

When I run the script below (which works very well the first time) for the second time, R returns some error messages.

Please, note that, during the second run, I also tried to execute each command independently to see if the problem was not related to a specific command (I suspected initGRASS() to be the cause of the problem)... but, in fact, each command returns an error message.

I am at your disposal if you would like me to do some tests to help you identify the source of the problem. Best regards, Loïc

Here is the list of executed commands and associated error messages :

1. initGRASS()

> initGRASS(gisBase ="C:/Program Files/GRASS GIS 7.8", 
          home="temp/GRASS_tmp", use_g.dirseps.exe=F, 
          gisDbase="temp/GRASS_tmp", mapset="PERMANENT", 
          remove_GISRC=T, `override=T)
Error in if (is.na(projstr)) uprojargs <- projstr else uprojargs <- paste(unique(unlist(strsplit(projstr,  : 
  l'argument est de longueur nulle
De plus : Warning messages:
1: In system(syscmd, intern = intern, ignore.stderr = ignore.stderr,  :
  l'exécution de la commande 'g.region.exe -g -3' renvoie un statut 313
2: In system(syscmd, intern = intern, ignore.stderr = ignore.stderr,  :
  l'exécution de la commande 'g.proj.exe -j -f' renvoie un statut 313

This error message is accompanied by the opening of a popup window indicating : "The procedure entry point GEOSMakeValid_r could not be located in the dynamic link library C:\Program Files\GRASS GIS 7.8\extrabin\gdal300.dll"

2. execGRASS()

> execGRASS(whatever the function "g.proj", "v.generalize"...)

For execGRASS, R does not return any error message. But there is still a popup windows indicating : "The procedure entry point GEOSMakeValid_r could not be located in the dynamic link library C:\Program Files\GRASS GIS 7.8\extrabin\gdal300.dll"


3. writeVECT() or readVECT() : same error message :

> writeVECT(seg_poly,"vec1",v.in.ogr_flags=c("o", "overwrite"), 
          driver="ESRI Shapefile")                                
Error in writeVECT(seg_poly, "vec1", v.in.ogr_flags = c("o", "overwrite"),  : 
  driver %in% candDrivers is not TRUE
De plus : Warning message:
In system(syscmd, intern = intern, ignore.stderr = ignore.stderr,  :
  l'exécution de la commande 'v.in.ogr.exe -f' renvoie un statut 313

This error message is accompanied by the opening of a popup window indicating : "The procedure entry point GEOSMakeValid_r could not be located in the dynamic link library C:\Program Files\GRASS GIS 7.8\extrabin\gdal300.dll"

rsbivand commented 4 years ago

On Winndows 10, R 4.0.2, stand-alone Windows GRASS 7.8.3, fully updated CRAN sp, rgdal, rgrass7, XML, I cannot reproduce your problem. Your use of arguments is unusual, but even so, nothing indicates problems. If initGRASS() fails, no subsequent command will work properly. I am assuming that you know that initGRASS() is run when library(rgrass7) reports: (GRASS not running) when the package is attached. It is also usual practice to use the SG= argument. I do not think this is an issue, please follow up on the grass-stat list.