[GRASS-user] shell script
Sandile Gumede
akasandile at gmail.com
Tue Jun 29 02:58:58 EDT 2010
Hi,
How do I set $LOCATION_NAME and $MAPSET, I've tried but still saying
LOCATION_NAME and MAPSET not set?
On Mon, Jun 28, 2010 at 11:51 AM, Paul Kelly
<paul-grass at stjohnspoint.co.uk>wrote:
> Sandile Gumede wrote:
>
>> Hi
>>
>> I'm trying to run the script below but it's giving me an error saying
>> default region is not set.
>>
>> Which command should I use to set the default region and do I put it?
>>
>> #!/bin/sh
>>
>> #variable to customize:
>> # path to GRASS software main directory
>> GISDBASE=/home/tgumede1/grassdata
>> LOCATION_NAME=Floods
>> MAPSET=PERMANENT
>> GISBASE=/usr/lib/grass64
>>
>
GSIDBASE= 'g.gisenv GISDBASE'
LOCATION_NAME='g.gisenv LOCATION_NAME'
MAPSET='g.gisenv MAPSET'
LOCATION="${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}"
> # nothing to change below
>> MAP=$1
>> LOCATION=$2
>>
>>
>> # generate temporal LOCATION:
>> TEMPDIR=FLOODS
>> mkdir -p $GISDBASE/$TEMPDIR/PERMANENT
>>
>> # save existing $HOME/.grassrc6
>> if test -e $HOME/.grassrc6 ; then
>> mv $HOME/.grassrc6 /tmp/$TEMPDIR.grassrc6
>> fi
>>
>> echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6
>> echo "MAPSET:PERMANENT" >> $HOME/.grassrc6
>> echo "DIGITIZER: none" >> $HOME/.grassrc6
>> echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6
>> export GISBASE=$GISBASE
>>
>> # Create a WIND file with minimal information and no projection:
>> echo "proj: 0
>> zone: 0
>> north: 1
>> south: 0
>> east: 1
>> west: 0
>> cols: 1
>> rows: 1
>> e-w resol: 1
>> n-s resol: 1
>> top: 1
>> bottom: 0
>> cols3: 1
>> rows3: 1
>> depths: 1
>> e-w resol3: 1
>> n-s resol3: 1
>> t-b resol: 1
>> " > $TEMPDIR/$LOCATION_NAME/$MAPSET/WIND
>> # Copy WIND-file to DEFAULT_WIND:
>> cp $TEMPDIR/$LOCATION_NAME/$MAPSET/WIND \
>> $TEMPDIR/$LOCATION_NAME/$MAPSET/DEFAULT_WIND
>>
>
>
> Where are the variables $LOCATION_NAME and $MAPSET being set? As far as I
> can see they seem to be empty - could that be the problem?
>
> Paul
>
>
--
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100629/a8110e6a/attachment.html
More information about the grass-user
mailing list