Usage of ps.map

Lars Schylberg larss at fmi.kth.se
Fri Apr 2 06:51:24 EST 1993


Well there has been some discussion about usage of ps.map lately.

I wrote a script that makes the usage a little easier if you just want
to print a raster map with title and legend.  Here it is.

Lars

Lars Schylberg                          Email: larss at fmi.kth.se  
Dept. of Geodesy and Photogrammetry 
Royal Institute of Technology (KTH)     Tel.   +46 8 790 86 33   
S-100 44  STOCKHOLM, SWEDEN             Fax.   +46 8 790 66 10



#!/bin/sh
#
#  ps.map.sh
#
#  Script that run ps.map 
#
#  Author: Lars Schylberg ( larss at fmi.kth.se )
#          Department of Photogrammetry
#          Royal Inst. of Technolgy
#          Stockholm, Sweden
#
#  Date: 930216
#  History of changes: 
#
#--------------------------------------------------------------------------
#					Check if GRASS is running
#
test "$GISRC" || echo "GRASS is not running" || exit 2
#----------------------------------------------------------------------------
#
#					Evaluate arguments
#
if [ $# != 2 ]
then
    echo
    echo Usage: `basename $0` 
    echo '       rast=mapname '
    echo '       scale=mapscale '
    echo
    exit 1
fi
#
#  parse input arguments
#
for i do
	case $i in
		rast*)
			RAST=`echo $i | sed s/rast=//` ;;
		ra*)
			RAST=`echo $i | sed s/ra=//` ;;
		r*)
			RAST=`echo $i | sed s/r=//` ;;
		scale=*)
			SCALE=`echo $i | sed s/scale=//` ;;
		sc=*)
			SCALE=`echo $i | sed s/sc=//` ;;
		s=*)
			SCALE=`echo $i | sed s/s=//` ;;
		*)
			echo ""
			echo "Unrecognized option: $i"
			echo 'Options: rast=mapname '
			echo '         scale=mapscale '
                        echo 
			exit 1
	esac
done
#-----------------------------------------------------------------------

#				Check the input arguments

eval `g.findfile element=cell file=$RAST`
if [ ! "$file" ] ; then
   echo "$RAST - clump cell file not found"
   exit 2
fi

if [ $SCALE -lt 100 -o $SCALE -gt 1000000 ]
then
   echo "This scale factor seems strange: 1:$SCALE "
   exit 2
fi
#-----------------------------------------------------------------------

eval `g.findfile element=cell_misc file=$RAST`

echo "Map: $RAST  Scale: 1:$SCALE"	> comments.file

echo "scale 1:$SCALE"	         > ps.map.input
echo "maploc 1.00 0.10"          >> ps.map.input
echo "greyrast $RAST"   	 >> ps.map.input
echo "comments comments.file"    >> ps.map.input
echo "where 1.00 0"		 >> ps.map.input
echo "font Helvetica Bold"       >> ps.map.input
echo "fontsize 10"               >> ps.map.input
echo "color black" 		 >> ps.map.input
echo "end"      		 >> ps.map.input
echo "colortable y"		 >> ps.map.input
echo "where 1.00 0"		 >> ps.map.input
echo "font Helvetica Bold"       >> ps.map.input
echo "fontsize 10"               >> ps.map.input
echo "end" 		 	 >> ps.map.input
echo "end "		         >> ps.map.input

#				Use only the first part of the file
#				name since the @ sign messes up the printing

RAST_NAME=`echo $RAST | gawk -F@ '{ printf "%s\n", $1 }'`

ps.map input=ps.map.input output=$RAST_NAME.ps

# 				Out local print command for ps-files
#
# prf -trans -nc -d $RAST_NAME.ps

rm -f ps.map.input comments.file
# rm -f $RAST_NAME.ps








More information about the grass-dev mailing list