[GRASS-user] GRASS Location from scratch: Solved
"Peter Löwe"
peter.loewe at gmx.de
Tue Jan 20 08:39:13 EST 2009
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):
###################################################################################
## LOCATION SETUP PREPARATION (FILESYSTEM)
#generate folders for temporal LOCATION and MAPSET
mkdir -p $CURRENT_DIR/$THE_LOCATION/$THE_MAPSET
mkdir -p $CURRENT_DIR/$THE_LOCATION/$THE_MAPSET/dbf
touch $CURRENT_DIR/$THE_LOCATION/$THE_MAPSET/MYNAME
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
" > $CURRENT_DIR/$THE_LOCATION/$THE_MAPSET/WIND
cp $CURRENT_DIR/$THE_LOCATION/$THE_MAPSET/WIND $CURRENT_DIR/$THE_LOCATION/$THE_MAPSET/DEFAULT_WIND
echo "DBF_DRIVER: dbf
DB_DATABASE : $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
" > $CURRENT_DIR/$THE_LOCATION/$THE_MAPSET/VAR
##################################################################################
#Set up a temporary grassrc-File:
echo "GISDBASE: $CURRENT_DIR
LOCATION_NAME: $THE_LOCATION
MAPSET: $THE_MAPSET
" > $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
# use process ID (PID) as lock file number:
export GIS_LOCK=$$
# settings for graphical output to PNG file
export GRASS_PNGFILE=$TMPDIR/grass6output.png
export GRASS_TRUECOLOR=TRUE
export GRASS_WIDTH=400
export GRASS_PNG_COMPRESSION=1
# path to GRASS settings file:
export GISRC=$TMPDIR/$THE_GRASSRC
g.proj -c epsg=4326
g.region -s n=90 s=-90 w=-180 e=180 res=1
g.region -p
Peter
--
Dr. Peter Löwe
<peter.loewe at gmx.de>
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
More information about the grass-user
mailing list