[GRASS-user] rgrass7 syntax for passing a command
Roger Bivand
Roger.Bivand at nhh.no
Fri Apr 29 00:18:09 PDT 2016
Simply, don't.
execGRASS() is for executing single GRASS commands, not a drop-in
replacement for bash.
Try something like creating the point in R with the correct projection, and
write that vector object to your mapset:
library(sp)
library(rgrass7)
pt <- SpatialPointsDataFrame(matrix(c(636645, 218835), ncol=2),
proj4string=CRS(paste(execGRASS("g.proj", flags="j", intern=TRUE),
collapse=" ")),
data=data.frame(x=1))
writeVECT(pt, "outlet")
You could create a temporary text file to read in:
tf <- tempfile()
writeLines("636645, 218835", tf)
execGRASS("v.in.ascii", input=tf, output="outlet1", separator=",",
flags="n")
which is closer to your script but less natural.
Yes, grass-stats is a more appropriate list.
Roger
-----
Roger Bivand
NHH Norwegian School of Economics, Bergen, Norway
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/rgrass7-syntax-for-passing-a-command-tp5263330p5263427.html
Sent from the Grass - Users mailing list archive at Nabble.com.
More information about the grass-user
mailing list