2010-07-19

Grass scripting is eeeaseee

Actually it is soooo eeeasy scripting in grass. And it is also possible under windows. I tried Grass SVN6.5 and launched it with MSYS. It uses SH and it is possible to do everything from command line, in addition to execute bash scripts (from here). So i tried it. I made one sample bash script which includes three chained modules. so here it is
#!/bin/sh#
# This program is Free Software under the GNU GPL (>=v2).
if test "$GISBASE" = ""; then
echo "You must be in GRASS to run this program."exit
fi
CONTOURS=_contours
g.region res=25
v.surf.rst --o input=urbumi elev=$1 zcolumn=liimenis
r.contour input=$1 output=${1}${CONTOURS} step=$2

This script 1) sets the computational resolution to 25, 2) runs v.surf.rst data interpolator taking input data from "urbumi" vector file and values (zcolumn) from table "liimenis" and outputs it in name as command`s first argument , and 3) it creates a contour lines from the previously interpolated raster and it is using script`s second argument as the step for contourlines.The next thing is to create the specific script, which takes a certain data in respect to given argument and then interpolates a raster from these certain data.