User Tools

Site Tools


wiki:grassvariables7

Setting GRASS70 variables for GRASS bash job

Insert these lines in your bash script allowing to run your script by bash name_script.sh. Of course set the settled directories in accordance to your directories.





echo "GISDBASE: /home/user/ost4sem/grassdb"      >  $HOME/.grass7/rc$$
echo "LOCATION_NAME: newlocation"                >> $HOME/.grass7/rc$$
echo "MAPSET: PERMANENT"                         >> $HOME/.grass7/rc$$
echo "GUI: text"                                 >> $HOME/.grass7/rc$$
echo "GRASS_GUI: wxpython"                       >> $HOME/.grass7/rc$$

path to GRASS binaries and libraries:

export GISBASE=/usr/lib/grass70
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
export LD_LIBRARY_PATH="$GISBASE/lib"
export GISRC=$HOME/.grass7/rc$$
export GRASS_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
export PYTHONPATH="$GISBASE/etc/python:$PYTHONPATH"
export MANPATH=$MANPATH:$GISBASE/man

use process ID (PID) as lock file number:

export GIS_LOCK=$$

settings for graphical output to PNG file (optional)

export GRASS_PNGFILE=/tmp/grass6output.png
export GRASS_TRUECOLOR=TRUE
export GRASS_WIDTH=900
export GRASS_HEIGHT=1200
export GRASS_PNG_COMPRESSION=1

test if your script is able to use grass command by asking the g.gisenv

g.gisenv
wiki/grassvariables7.txt · Last modified: 2017/12/05 22:53 (external edit)