Print maps using SPARCprinter

Lars Schylberg larss at fmi.kth.se
Thu Dec 23 04:38:31 EST 1993



As far as I remember there used to be a bug in the interactive version of
ps.map.  I  don't if it has been fixed.  It is possible to run it with 
command line arguments however.  Here is a small script that I have used
to output simple raster maps. It shows the principle.

Happy  Xmas to everyone !

Lars

#!/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"	> comments.file

if [ ! "$file" ] ; then
  echo ""          	>> comments.file
  cat $file/RULE.*  	>> comments.file
fi

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

ps.map input=ps.map.input output=$RAST.ps
rm -f ps.map.input comments.file
prf -trans $RAST.ps
rm -f $RAST.ps




More information about the grass-user mailing list