[GRASS-user] Script fails; manual entry works

Rich Shepard rshepard at appl-ecosys.com
Wed Sep 18 15:36:11 PDT 2019

On Wed, 18 Sep 2019, Moritz Lennert wrote:

> You cannot launch GRASS GIS within the script in this way. You have to
> put the actual module calls into a script and then either
> - launch GRASS GIS and from the GRASS command line launch the script, or
> - follow
>  https://grasswiki.osgeo.org/wiki/GRASS_and_Shell#GRASS_Batch_jobs,
>  i.e. let the GRASS_BATCH_JOB variable point to your script


Through a lot of trial-and-error I've learned that all I can batch are the
commands run in a single location. For each row in the Ohio-system (A-H from
south to north) there are 8 columns and I was trying -- and failing -- to
process each row (G1-G8) in a single batch file.

I've learned that I can create a shell script file that creates eight new
locations, one for each column in the row.

But I cannot import then reproject (twice) in a single batch file because
each action is done in a different location.

What I need to do is create 24 batch files and run each manually by setting
and unsetting the GRASS_BATCH_JOB environmental variable. This is actually
longer than copying and pasting lines from the inclusive (but ineffective)
batch file to the command line, invoking and exiting grass after all
operations in a single location.

I'll add a feature request for 8.x in trac to expand batch file processing
so that commands such as r.in.gdal/r.import in one location can be followed
by r.proj in other locations.

Thanks for the pointers,


More information about the grass-user mailing list