[R-sig-Geo] RGRASS7 and Initgrass

PONS Frederic - CEREMA/DTerMed/DREC/SRILH Frederic.Pons at cerema.fr
Wed May 4 13:18:41 CEST 2016


Dear all

I am working on windows 7.

I have update my version of GRASS GIS 7.0.4 and R-3.2.5.

I try to work with my old tools and I meet a problem with function 
InitGrass. i just want to share this problem and if possible understand 
if the problem depend on my installation of grass and r or release of 
InitGrass.

Before I can use:
loc=initGRASS(gisBase =
Chemin_de_l_exe_de_Grass,home=Chemin_des_donnees_Grass,gisDbase=Chemin_des_donnees_Grass,location=Localisation,mapset=Jeu_de_donnees,override=T)
I have this problem:
Error in if (class(t0) != "try-error" && is.character(t0) && nchar(t0) > 
: missing value where TRUE/FALSE needed

I thonk it is in this osurce code:
https://github.com/cran/rgrass7/blob/master/R/xml1.R

I solve the problem uisng a false folder
loc=initGRASS(gisBase = 
Chemin_de_l_exe_de_Grass,home=Chemin_des_donnees_Grass,gisDbase=Chemin_des_donnees_Grass,addon_base=Chemin_de_l_exe_de_Grass,location=Localisation,mapset=Jeu_de_donnees,override=T)

Best regards

File: C:\Program Files\R\R-3.2.5\Cerema
#Chemin de l'exe de Grass
C:\GRASS GIS 7.0.4
#Monde Grass temporaire (1=oui, 0=non)
0
#Chemin des donnees Grass
C:\GRASSDATA
#Localisation
Cerema
#Jeu de donnees
test
#Projection (EPSG)
2154
#Chemin des routines R
C:/PROGRA~1/R/R-32~1.5/cerema


Code:
# DICARTO_00_LectureMondeGrass
# Version 2.0 06/10/2015
# Cerema
# Frederic Pons, Celine Trmal

DICARTO_00_LectureMondeGrass = function(chem_routine,Numero_de_calcul)
{
   # Lecture de l'initialisation et création du monde Grass
fichier_init=paste(chem_routine,"\\Init_Routine_Cerema",as.character(Numero_de_calcul),".txt",sep="")
   fid=file(fichier_init, open = "r")
   lignes <- readLines(fid)
   close(fid)

   Chemin_de_l_exe_de_Grass=as.character(lignes[2])
   Chemin_des_donnees_Grass=as.character(lignes[6])
   Localisation=as.character(lignes[8])
   Jeu_de_donnees=as.character(lignes[10])
   Projection=as.numeric(lignes[12])
   Monde_grass_temp=as.numeric(lignes[4])

   if (Monde_grass_temp==0) {
     loc=initGRASS(gisBase = 
Chemin_de_l_exe_de_Grass,home=Chemin_des_donnees_Grass,gisDbase=Chemin_des_donnees_Grass,addon_base=Chemin_de_l_exe_de_Grass,location=Localisation,mapset=Jeu_de_donnees,override=T)
     ## convert default coordinate system x,y to epsg code 3347 (can be 
altered later)
#execGRASS("g.mapset",flags=c("c"),parameters=list(mapset="PERMANENT"))
     #execGRASS("g.proj",flags=c("c"),epsg=as.integer(Projection))
#execGRASS("g.mapset",flags=c("c"),parameters=list(mapset=Jeu_de_donnees))
   } else {
     loc=initGRASS(Chemin_de_l_exe_de_Grass, 
home=tempdir(),addon_base=Chemin_de_l_exe_de_Grass,override=T)
   }

return(cbind(Chemin_de_l_exe_de_Grass,loc$GISDBASE,loc$LOCATION,loc$MAPSET,Projection))
}
*Frédéric Pons *
*Expert hydraulique sur les inondations et aléas côtiers
**DREC/Service Risques Inondations Littoraux et Hydraulique **- Tél.: 
(33)4 42 24 76 68 *
*Direction Territoriale Méditerranée
*
Centre d’études et d’expertise sur les risques, l’environnement, la 
mobilité et l’aménagement
www.cerema.fr <http://www.cerema.fr>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160504/a605343e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cerema.png
Type: image/png
Size: 6094 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160504/a605343e/attachment.png>


More information about the R-sig-Geo mailing list