[GRASS5] $LOCATION or not $LOCATION ?

Markus Neteler neteler at itc.it
Thu May 16 01:49:39 EDT 2002


On Wed, May 15, 2002 at 10:28:31PM +0100, Glynn Clements wrote:
> 
> Helena wrote:
> 
> > > Note that the above example would have worked before the settings were
> > > removed from Init.sh. However, anything which used the environment
> > > variables (e.g. tcltkgrass, nviz, and most scripts) would continue to
> > > use the settings with which the session was started.
> > 
> > this is really confusing and if we want to keep the change it needs to be
> > clearly
> > explained at a prominent place when downloading the new release. Do I
> > understand
> > it correctly that in the previous example if I do
> > 
> > nviz nations
> > 
> > the map won't be there because nviz would still use the original LOCATION?
> > 
> > Do the current scripts released with GRASS which use $LOCATION work
> > correctly? -
> > or what is the correct behavior - as I understand it they would use the
> > original LOCATION
> > and not the one set by g.gisenv?
> > Or am I completely missing something here?
> 
> Anything which was found to be dependent upon the environment
> variables was fixed. AFAIK, this includes everything in src/scripts,
> plus tcltkgrass and nviz.
> 
> However, I can't absolutely rule out the possibility that something
> may have slipped through the net. Now that you mention it, I recall
> Markus mentioning a Perl script which needed fixing; I don't recall
> the outcome, though.

We had problems with our *local* scripts (30 or more). Eventually
a PERL script in GRASS also needs a fix.

Our workaround for PERL was to

#read the GRASS variables:
open(RRR,"g.gisenv |");
while(<RRR>){
    chop();
    chop();
    @part=split(/=/,$_);
    $part[1]=~s/\'//g;
    $ENV{"$part[0]"}="$part[1]";
}
close RRR;
$ENV{LOCATION}="$ENV{GISDBASE}/$ENV{LOCATION_NAME}/$ENV{MAPSET}";

which looks pretty complicated compared to Shell scripts.
Is there a more elegant solution to get the environment into
PERL (I am no PERL users).

Also Helena was refering to her local scripts. We have to teach
people how to upgrade.

Markus



More information about the grass-dev mailing list