[GRASS-user] Using GRASS modules outside GRASS

Jana Krajcovicova jkrajc at gmail.com
Tue Aug 9 09:57:06 EDT 2011


Hello,

I would like to call GRASS modules from other programs - e.g. shell or perl.
The information I found on grass wiki was a bit confusing for me,
nevertheless I decided to test this possibility.
I added GRASS environmental variables to my .bashrc file:

# path to GRASS binaries and libraries:
export GISBASE=/usr/lib64/grass-6.3.0
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib
export GISRC=/home/mirka/grass/gisrc
export GIS_LOCK=.gislock

Now, when I wrote a script, I create the gisrc file on the fly inside the
script, specifying the location and mapset.
Then I call a GRASS module, e.g., r.report, directly and it works fine.
However, what bothers me, is the gislock, as it doesn't work properly -
i.e., when I run the script outside GRASS it performs an operation on the
specified location/mapset combination even in case the same combination of
location/mapset is explicitly opened in another terminal.  I guess something
is wrong with my specification of GIS_LOCK env. variable ...

I am not sure how this is supposed to operate, but what I observe is that
the env. variables which I specify in .bashrc file, namely GISRC are only
used for the modules called from scripts outside GRASS. When I open a
location/mapset combination directly using grass, it creates gisrc file in
/tmp/grass6-username-processID directory.
As for the .gislock, I thought it should always be  located in the
corresponding gisdbase/location/mapset directory. Then, why my scripts
ingnore .gislock created by explicitly opened GRASS location/mapset?

I hope my narration is not too confusing :-)

Jana

-- 
******************************************
Jana Krajčovičová, PhD.
Department of Air Quality
Slovak Hydrometeorological Institute
Jeséniova 17
831 01 Bratislava

jana.krajcovicova at shmu.sk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20110809/5b829e07/attachment.html


More information about the grass-user mailing list