[GRASS-user] GRASS Location from scratch: Solved

Paul Kelly paul-grass at stjohnspoint.co.uk
Tue Jan 20 10:00:11 EST 2009


On Tue, 20 Jan 2009, "Peter Löwe" wrote:

> Hi,
>
> here is a working (bash-)scripting approach on how to conjure up a minimalistic xy-location out of thin air and to transmogrify the projection (f.e. EPSG:4326):

It doesn't really need to be so long though - in recent versions of GRASS 
g.proj doesn't require a dummy location in order to run. This should do it 
almost as well:

###################################################################################
## LOCATION SETUP PREPARATION (FILESYSTEM)

##################################################################################
#Set up a temporary grassrc-File:

echo "GISDBASE: $CURRENT_DIR
" > $TMPDIR/$THE_GRASSRC

#################################################################################
# Export paths to GRASS binaries and libraries:

  export GISBASE=/opt/grass
  export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib

  # path to GRASS settings file:
  export GISRC=$TMPDIR/$THE_GRASSRC

g.proj -c epsg=4326 location=$THE_LOCATION

##################################################################################
#Delete temporary grassrc-File:

rm $TMPDIR/$THE_GRASSRC



The only difference is the default region will have an extent of 1 in all 
directions. If you want to run a g.region command to set it at the end you 
need to update the GISRC file with the name of the newly-created location 
and PERMANENT mapset.

Paul


More information about the grass-user mailing list