[R-sig-Geo] Least Cost Routing and execGRASS

Mark Wynter mark at dimensionaledge.com
Wed Feb 13 12:05:36 CET 2013


Is it possible to pipe in values to a GRASS command via execGRASS?  The context is least cost routing and network analysis using the v.net function.

To calculate a least-cost route from directly within GRASS, the syntax is:
# Fastest path: ID as first number, then cat1 and cat2
echo "2 52 27"|v.net.path --overwrite input=network_cat3 at user1 output=path_52_27_db_cost alayer=3 afcolumn=cost

At times it might be necessary to update the GRASS cost table, which again requires the use of a pipe delimiter in the syntax. 
echo "UPDATE network_cat3_3 SET cost=lungh_a/speed/1610" | db.execute

These examples have been drawn from...
http://www.ing.unitn.it/~grass/docs/tutorial_64_en/htdocs/esercitazione/network_analysis/node4.html

Note the use of pipes.  Can these be incorporated within the execGRASS command?  Alternatively, is there another syntax?

Best regards
Mark


More information about the R-sig-Geo mailing list