ps.map -> sites -> label problem

Rick Thompson rick at cast.uark.edu
Wed Sep 27 15:06:19 EDT 1995


On 27 Sep 1995, Kim Dralle wrote:

> With ps.map I want to print sites along with their labels, but without the text framed with squares. Is there an easy way to ommit these squares?

Hi Kim,
  You can use labels in ps. See the documentation of ps.map. You can use a 
script like below to convert sites to labels.
------------------------------------------------------------------------
Rick Thompson-   Research Specialist          E-mail: rick at cast.uark.edu
Center for Advanced Spatial Technologies      Telephone: (501) 575-8498
Ozark Hall Rm. 12                             Fax: (501) 575-5218
University of Arkansas              
Fayetteville, AR 72701

------------cut here ---------------------------------------------------------
:
# *** This is s.to.label . ***
#
#
# @(#) convert site file to labels file for ps.map.
 
if [ `uname -m` = mips ] ; then
  ECHON="/usr/bsd43/bin/echo -n"
elif [ `uname -s` = SunOS -a `uname -r | sed 's/\...*$//'` = 5 ] ; then
  ECHON="/usr/ucb/echo -n"
else
  ECHON="echo -n"
fi
 
if [ -z "$GISRC" ] ; then
  clear
  echo "This command must be run from GRASS!"
  echo ''
  exit 1
fi
 
clear
echo ''
g.ask type=old prompt="Make labels for which site map?" \
  element=site_lists desc=site unixfile=/tmp/$$
. /tmp/$$
rm -f /tmp/$$
if [ ! -f $file ]; then
  echo "Site map $name not found."
  echo ''
  exit
fi
 
echo ''
$ECHON "Size: "
read size
 
echo ''
 
echo ''
if [ -f $LOCATION/cell/MASK ] ; then
  $ECHON 'Remove MASK? (n) '
  read ans
  if [ "$ans" = "y" -o "$ans" = "Y" ] ; then
    g.remove rast=MASK > /dev/null
  else
    echo ''
    $ECHON 'Want to zoom in on the MASK? (y) '
    read ans
    if [ "$ans" = "y" -o "$ans" = "Y" -o -z "$ans" ] ; then
      g.region rast=MASK z=MASK
    fi
  fi
fi
 
if [ -f $LOCATION/cell/MASK ] ; then
  echo ''
  $ECHON 'Mask the points (n) '
  read ans
  if [ "$ans" = "y" -o "$ans" = "Y" ] ; then
    r.mask.points mask=MASK input=$file fs='|' \
      > $LOCATION/site_lists/tmpsite.mask
    file=$LOCATION/site_lists/tmpsite.mask
  fi
fi
 
cat $file | sed '/name/d' | sed '/desc/d' | awk '
        {
        FS="|"
        printf("east:               %f\n",$1)
        printf("north:              %f\n",$2)
        printf("xoffset:\n")
        printf("yoffset:\n")
        printf("ref:                center\n")
        printf("font:               helvetica\n")
        printf("color:              black\n")
        printf("size:               '$size'\n")
        printf("width:              1\n")
        printf("hcolor:             white\n")
        printf("hwidth:             2\n")
        printf("background:         none\n")
        printf("border:             none\n")
        printf("opaque:             no\n")
        printf("\n")
        printf("text:%s\n",$3)
        printf("\n")
        }' > $LOCATION/paint/labels/$name
 
 
if [ -f $LOCATION/site_lists/tmpsite.mask ] ; then
  rm $LOCATION/site_lists/tmpsite.mask
fi



More information about the grass-user mailing list