[GRASSLIST:5543] Re: Command-line invocation
Glynn Clements
glynn.clements at virgin.net
Thu Feb 13 14:46:17 EST 2003
Michael Ash wrote:
> I would like to run v.support on many vector maps across mapsets and
> want to use a shellscript to manage the process.
>
> With GISDBASE, LOCATION_NAME, MAPSET, etc., properly defined, is it
> possible to invoke GRASS with either a single grass command or the
> name of a grass shellscript, thus:
>
> export MAPSET=angola
> % grass5 - -text <grass command or grass shellscript to run v.support on several vector maps>
> export MAPSET=botswana
> % grass5 - -text <grass command or grass shellscript to run v.support on several vector maps>
> export MAPSET=burundi
>
> etc., etc.,
>
> I am open to other suggestions if there is a better way. (I have the
> countries in separate mapsets because the vector maps have the same
> generic name for each country (e.g., "airports").
Contrary to what is variously stated and implied in the GRASS
documentation, GISDBASE, LOCATION_NAME and MAPSET are *not*
environment variables.
GRASS modules obtain these parameters from the file specified by
$GISRC (which defaults to $HOME/.grassrc5). It *used* to be the case
that the contents of $GISRC were reflected into the environment at
startup (i.e. an environment variable was created for each setting in
$GISRC). However, this is no longer true, and even when it was true,
most programs (i.e. anything written in C) would obtain the setting
from $GISRC, not the environment.
FWIW, in 5.0.0 and later (but not most of the -beta or -pre versions),
you can mostly[*] get away with switching between mapsets within a
session, using e.g.:
g.gisenv set=MAPSET=botswana
[*] The exact set of cases which don't work is unknown; however,
tcltkgrass definitely won't recognise any such changes, and monitors
should be cleared (with d.erase) whenever any of these settings
change. Also, you assume responsibility for ensuring that you don't
have two concurrent sessions writing to the same mapset (IOW, don't do
it in a multi-user environment).
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list