0

I have installed GRASS in my Ubuntu system. Library "rgrass7" is successfully installed and imported. but, while running the code I am getting an error :

Error in parseGRASS(cmd, legacyExec = legacyExec) : The command g.mapset --interface-description could not be run (127), and produced the error message: sh: 1: g.mapset: not found

I am getting this error for all the utilities of Grass such as "r.region" and "r.water.outlet". A sample of the code is given here:

library(raster)
library(sp)
library(rgdal)
library(XML)
library(rgrass7)
xmin <- '83.988354'
xmax <- '85.250147'
ymin <- '19.100341'
ymax <- '20.352327'
res <- '0.0003'
grass.dir <- normalizePath('~/grass')
if (!file.exists(grass.dir)){
dir.create(grass.dir)
}
print(grass.dir)
location.name = sprintf("s1_%s", Sys.getpid())
initGRASS(gisBase = "/home/vigna/GrassData",
     gisDbase = grass.dir, location = location.name,
     mapset = "PERMANENT", override = TRUE)
execGRASS("g.proj", flags = "c", epsg = 4326)
mapset_flag = file.exists(file.path(grass.dir, location.name, 'mapset'))
print(mapset_flag)
if (! mapset_flag){
   execGRASS("g.mapset", flags = c("c"),
        mapset = "mapset")
 }

What is wrong?

  • Can you please add the GRASS GIS version used? g.version -g – markusN Jan 4 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.