I'm trying to execute some rgrass7 processing from R but I can't even get the first process done. I would like to clean a vector line layer. The goal here is not just to clean the topology, that's collateral, but learning how to execute rgrass7 processes with vector data.
Here is the code that throw error:
library(rgrass7)
# PARAMETERS
lpath <- "./Layers/Lines_light/Lines.shp"
l <- readOGR(lpath)
G <- initGRASS(gisBase = "/usr/lib/grass76",
home = getwd(),
gisDbase = getwd(),
location = 'grassdata',
mapset = "PERMANENT",
override = TRUE)
G
use_sf()
# clean (here, in input, I tried l, "l", "lpath", lpath...
execGRASS("v.clean",
input = "lpath",
output = 'l_clean',
tool = 'break',
flags = 'c')
The error:
Error in execGRASS("v.clean", input = "lpath", output = "l_clean", tool = "break", :
The command:
v.clean -c input=lpath output=l_clean tool=break
produced an error (1) during execution:
ERROR: El mapa vectorial <lpath> no se ha encontrado
By the way, the tool work just perfect from QGIS in Ubuntu 19.10.
v.import
step before doing anything with the map in GRASS GIS.