[GRASS-user] g.region (was v.to.rast conversion)
Glynn Clements
glynn at gclements.plus.com
Tue Dec 15 11:42:15 EST 2009
Giacomo Piva wrote:
> Hamish wrote:
> I followed the instructions in the chapter "Automated usage of grass" in
> the Markus's book and I created a bash script in order to prepare the
> grass enviroment:
>
> #!/bin/bash
> LOCATION=test
>
> GISBASE=/usr/local/grass-6.5.svn
> GISDBASE=/usr/local/share/grassdata
>
> rm $HOME/.grassrc6
> rm -rf "$GISDBASE/$LOCATION" #cleaning LOCATION
>
> TMPDIR=$$.tmp
> mkdir -p $GISDBASE/$TMPDIR/temp
>
> echo "LOCATION_NAME: $TMPDIR" > $HOME/.grassrc6
> echo "MAPSET: temp" >> $HOME/.grassrc6
> echo "DIGITIZER: none" >> $HOME/.grassrc6
> echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6
>
> export GISBASE=$GISBASE
> export GISRC=$HOME/.grassrc6
> export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
>
> After these lines I run the v.in.ogr module to import the vector:
> v.in.ogr -o -e dsn=./test_data/test_data.shp output=grass_map
>
> And the following is the error i get.
> ERROR: region for current mapset is not set
> run "g.region"
>
> I tried to get the g.region help message, also I tried to reset the
> region (with g.region -d) and to set a default region (with g.region -s)
> but I get always the same error.
You have to create a valid location and mapset. It isn't enough that
the directories exist; they have to contain certain files. At an
absolute minimum, you need the $GISDBASE/$LOCATION_NAME/$MAPSET/WIND
file. You may also need the $GISDBASE/$LOCATION_NAME/PERMANENT
directory and some or all of the files:
$GISDBASE/$LOCATION_NAME/PERMANENT/DEFAULT_WIND
$GISDBASE/$LOCATION_NAME/PERMANENT/MYNAME
$GISDBASE/$LOCATION_NAME/PERMANENT/PROJ_INFO
$GISDBASE/$LOCATION_NAME/PERMANENT/PROJ_UNITS
$GISDBASE/$LOCATION_NAME/$MAPSET/VAR
If your automated sessions all use the same projection, you can use an
existing location, and only generate a new mapset for each automated
session. Then you only need to create the mapset directory and the
WIND file (which can be copied from ../PERMANENT/DEFAULT_WIND).
Alternatively, you can create a "skeleton" database, and make a copy
of that for each session.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list