Difference between revisions of "GRASS and windows console"

From GRASS-Wiki
Jump to: navigation, search
(add link to python modules)
Line 14: Line 14:
 
call v.db.addcolumn map=myreg columns="col1 double"
 
call v.db.addcolumn map=myreg columns="col1 double"
 
v.to.db map=myreg option=area columns=col1
 
v.to.db map=myreg option=area columns=col1
 +
</source>
 +
 +
Running batch files without starting up Grass:
 +
 +
<source lang="bat">
 +
"%ProgramFiles?%\QGIS 2.18\bin\Grass72.bat" --exec MyScript.bat D:/myGrassData/MyLoc/MyMapset
 
</source>
 
</source>

Revision as of 04:31, 18 September 2017

This page shows an example how to run several GRASS modules in a windows batch-file in the winGRASS windows console

Windows batch files in GRASS

In order to ease the workflow of analysis, several GRASS modules can be invoked at once by an batch file (*.bat) in the winGRASS windows console.

Python grass modules (e.g. v.db.addcolumn) have to be invoked by call in the batch-file.

@ECHO ON
g.region -p
v.in.region output=myreg
call v.db.addtable map=myreg
call v.db.addcolumn map=myreg columns="col1 double"
v.to.db map=myreg option=area columns=col1

Running batch files without starting up Grass:

"%ProgramFiles?%\QGIS 2.18\bin\Grass72.bat" --exec MyScript.bat D:/myGrassData/MyLoc/MyMapset