Create GRASS database by script

Hi all,

I would like to create a new GRASS databse
(with location definition etc.) by script.

Is there a way to do that?

Thank you

  Markus Neteler

-----------------------------------------------------------------
Geographisches Institut | Schneiderberg 50
  + Physische Geographie 30167 Hannover, Germany
  & Landschaftsoekologie + Tel: ++49-(0)511-762-4494 /-3924
Universitaet Hannover Fax: ++49-(0)511-762-3984
                neteler@geog.uni-hannover.de
        Bereich Geographie – Naturwissenschaftliche Fakultät – Leibniz Universität Hannover
-----------------------------------------------------------------

Markus Neteler wrote:

Hi all,

I would like to create a new GRASS databse
(with location definition etc.) by script.

Is there a way to do that?

It depends what you really need : creating a database consists
mainly by some mkdir commands followed by the creation of the
PERMANENT location with the (text) files WIND, DEFAULT_WIND, MYNAME,
and maybe PROJECTION.

It isn't difficult to write a shell script doing that (or a
Tcl/tk script if you like graphic interfaces, but you can give
attributes to a shell script, so it may be easier to batch
the creation of multiple locations)

Maybe something like that for a command line :

m.create.location Middle-earth.PERMANENT "Gis for Tolkien stories" \
xmin=345000 ymin=756000 xmax=350000 ymax=760000 xres=50 yres=50

--
Michel Wurtz ENGEES - CEREG
                1, quai Koch - BP 1039, F-67070 STRASBOURG cedex
                Tel: +33 03.88.24.82.45 Fax: +33 03.88.37.04.97

Markus,

You can use ECHO $var > file.name

to create the files (i.e., DEFAULT_WIN)
where $var contains text that you pass to the script in
the command line. For the first line you use > and
for the rest >> to append.
You can also create the directories with mkdir.
For example (this is not tested):

#!/bin/csh
#set echo
#set verbose
(uncomment for testing)
set nameLOC = $argv[1]
set nameMAPS = $argv[2]
set defWIN.proj = $argv[3]
etc
mkdir $nameLOC
cd $nameLOC
mkdir PERMANENT
cd PERMANENT
echo "proj: " $defWIN.proj > DEFAULT_WIN
echo "zone: " $defWIN.zone >> DEFAULT_WIN

and so on.

Agus

****NOTE NEW PHONE NUMBER*****
Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo@ija.csic.es
http://pangea.ija.csic.es/alobo

On Fri, 28 May 1999, Markus Neteler wrote:

Hi all,

I would like to create a new GRASS databse
(with location definition etc.) by script.

Is there a way to do that?

Thank you

  Markus Neteler

-----------------------------------------------------------------
Geographisches Institut | Schneiderberg 50
  + Physische Geographie 30167 Hannover, Germany
  & Landschaftsoekologie + Tel: ++49-(0)511-762-4494 /-3924
Universitaet Hannover Fax: ++49-(0)511-762-3984
                neteler@geog.uni-hannover.de
        http://www.geog.uni-hannover.de/users/neteler/
-----------------------------------------------------------------