On Jul 26, 2008, at 9:00 AM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]
> wrote:
Date: Sat, 26 Jul 2008 12:17:05 -0300
From: "Milton Cezar Ribeiro" <[EMAIL PROTECTED]>
Subject: [GRASS-user] running script on Native Wingrass.
To: grass-user@lists.osgeo.org
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"
Dear all,
Sorry to write again on this issue, but I still need help on this.
I installed Native WinGrass (on c:\GRASS directory) and
GRASS_MSYS_Environment
(on c:\GRASS_MSYS_Environment directory). Now I need to run a script
of
grass
commands, but I only know how to run one-by-one command. I really need
some help (with a step-by-step advice) of how can I tell to Grass
(or GIS.m
interface)
to call my script file and run a sequence of commands.
1. Write a script in GRASS format
2. Put it into the GRASS scripts directory [path to grass]\scripts
3. Make sure that you have the proper permissions to run it (you
probably do, but sometimes this is an issue)
4. Type the name of the script in the command window (at the bottom of
the output screen) and press "run". If you just type the name, without
any arguments, the script will open with a simple GUI that allows you
to enter arguments and run it. If you type the name with arguments, it
will run and do whatever it is supposed to do.
If you have never written scripts, there are tutorials on the GRASS
WIKI for how to write them. Traditionally, scripts have been written
in the bash shell scripting language because it usually comes
preinstalled on many Linux/Unix systems. With MSys installed, you can
use this language in Windows too. In addition to the WIKI, you can
look at the many examples already in the GRASS scripts directory.
An overview of scripting can be found at: http://grass.osgeo.org/wiki/Scripting
However, I very much recommend that you try scripting with Python.
This is an open source language that is more powerful and much easier
to work with than bash shell scripts. It is also cross-platform with a
binary version for Windows you can easily install from http://www.python.org
.
Instructions for creating GRASS Python scripts can be found on the
WIKI at: http://grass.osgeo.org/wiki/GRASS_and_Python. A document
explaining GRASS scripting standards is available here: http://svn.osgeo.org/grass/grass/trunk/SUBMITTING_PYTHON
. A new GRASS python library will soon be available to make this even
easier.
Some information on the syntax to build the simple GUI for scripts if
here: http://grass.ibiblio.org/grass63/manuals/html63_user/g.parser.html
But it is incomplete in that there are more options available than
listed.
I recently ported a bash script I wrote some years ago to Python. You
can see it here:
http://www.public.asu.edu/~cmbarton/files/grass_scripts/r_in_aster.py
I hope this is helpful.
Michael
Kind regards,
miltinho astronauta
brazil
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user