Help with running GRASS commands from a Window batch file

1 message Options
Embed this post
Permalink
bpost

Help with running GRASS commands from a Window batch file

Reply Threaded More More options
Print post
Permalink
Hi all,

WinXP SP2
Grass installed using: WinGRASS-6.4.0SVN-r38537-1-Setup.exe

I am working on creating a simple batch file that takes in a GeoTIFF, creates a new Location, does some work on the image and then spits out the final product.

I started by copying the environment setup commands from $GISBASE\grass64.bat and removed the call to $GISBASE\etc\Init.bat.

I started by adding in a call to
g.proj.exe -pc georef=<path to image> location=test
and verified that a new location named "test" was placed in my $GISDATA directory, including the PERMANENT folder and the DEFAULT_WIND, PROJ_INFO, PROJ_UNITS, and WIND files.

Then I added in
r.in.gdal.exe input=<path to image> output=aerial 
and verified that it created aerial.red, aerial.green, aerial.blue, and aerial.4.

When I added the command to create an RGB
r.composite.exe red=aerial.red green=aerial.green blue=aerial.blue levels=1 output=aerial
I got an error telling me to set the region using r.region.

So I added in
r.region map=aerial.red
to set the region based on the size of the red channel.

When I ran this, all of the executables started throwing unhandled exceptions (stack overflow, divide by zero, etc.)  So I started removing commands in the batch until only the g.proj.exe command remained and I was still getting unhandled exceptions.

At this point I decided to restart my computer and reinstall GRASS.  Now when I run the batch file, none of the commands do anything.  Even g.proj.exe -help shows nothing in the command window.

Has anyone run into this, or know of a workaround/fix to this issue?

The commands all work in the GUI, so I am not sure why they won't work in a batch file.

Thanks for your time!

Ben