Newsgroups: info.grass.programmer,info.grass.user
Path: zorro.cecer.army.mil!weller
From: weller@zorro.cecer.army.mil (Bonnie Weller)
Subject: Is there a script file to create paint labels out there?
Message-ID: <C9t33L.JDC@news.cecer.army.mil>
Sender: news@news.cecer.army.mil (Net.Noise owner)
Organization: US Army Corps of Engineers Construction Engineering Research La
bs
Date: Wed, 7 Jul 1993 17:54:57 GMT
Lines: 12Hi,
Does anyone know of a script file (perhaps in awk) that uses the
existing information in the dig_att and dig_cat files to create the
paint labels files for the same data layer? I have been trying to
write one, when it occured to me that maybe someone else already has.
Please let me know.Bonnie
weller@zorro.cecer.army.mil
These are a couple of scripts we use - one to convert dig_att files to
site files, and a second to convert site files to paint labels. It presently
does not include the dig_cat string in the conversion, but a join between the
site file and the dig_cats file would not be too difficult.
Thanks to Sue Huse at Berkeley for writing these.
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: digatt_2_site s.labels
# Wrapped by gardels@sonoma.ced.berkeley.edu on Wed Jul 7 16:27:11 1993
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'digatt_2_site' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'digatt_2_site'\"
else
echo shar: Extracting \"'digatt_2_site'\" \(629 characters\)
sed "s/^X//" >'digatt_2_site' <<'END_OF_FILE'
X#!/bin/sh
X# get the dig file name
Xif [ $# -eq 1 ]
Xthen
X digfile=`basename $1`
X digdir=`dirname $1`
X digpathname=$digdir/$digfile
X
Xelse
X
X if [ ! -d $LOCATION/.tmp/`hostname` ] ; then mkdir
$LOCATION/.tmp/`hostname` ; fi
X g.ask type=old prompt="enter name of a labeled vector file"
element=dig_att unixfile=$LOCATION/.tmp/`hostname`/diglist$$
X . $LOCATION/.tmp/`hostname`/diglist$$
X digfile=$name
X digpathname=$file
X if [ x$digfile = x ]
X then
X exit 1
X fi
Xfi
X
Xif [ ! -d $LOCATION/site_lists ] ; then mkdir $LOCATION/site_lists ; fi
Xawk '{printf ("%14.6f|%14.6f|#%d\n", $2, $3, $4)}' $digpathname >
$LOCATION/site_lists/$digfile
END_OF_FILE
if test 629 -ne `wc -c <'digatt_2_site'`; then
echo shar: \"'digatt_2_site'\" unpacked with wrong size!
fi
# end of 'digatt_2_site'
fi
if test -f 's.labels' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'s.labels'\"
else
echo shar: Extracting \"'s.labels'\" \(1728 characters\)
sed "s/^X//" >'s.labels' <<'END_OF_FILE'
X#!/bin/sh
X
Xecho
Xecho "s.labels creates a GRASS labels file from an existing sites file"
X
Xg.ask type=old element=site_lists prompt="Enter the name of a sites file: "
unixfile=/tmp/g.ask$$
X. /tmp/g.ask$$
Xif [ ! "$file" ]
Xthen
X exit 1
Xfi
X
Xsites=$file
X
Xfullname=0
Xg.ask type=new element=paint/labels prompt="Enter the name of the labels file
to be created" unixfile=/tmp/g.ask$$
X. /tmp/g.ask$$
Xif [ 0 = "$fullname" ]
Xthen
X exit 1
Xfi
X
Xlabels=$file
X
X
X#creates a new labels file from a sites file
Xecho "What color would you like your labels to be? "
Xecho -n "> "
Xread color
Xecho "What size (in meters on the ground) would you like your labels to be? "
Xecho -n "> "
Xread size
Xecho "Where do you want the label relative to the sites coordinates?"
Xecho " options are:"
Xecho " center"
Xecho " upper left upper right upper center"
Xecho " lower left lower right lower center"
Xecho -n "> "
Xread ref
Xecho "What font would you like?"
Xecho "Common options are:"
Xecho " romans romant helvetica"
Xecho -n "> "
Xread font
Xecho $color $ref $font $size
X
X
X
Xawk '
XBEGIN { FS = "|" }
X{
X printf("east: %f\n",$1)
X printf("north: %f\n",$2)
X printf("xoffset:\n")
X printf("yoffset:\n")
X printf("ref: '$ref'\n")
X printf("font: '$font'\n")
X printf("color: '$color'\n")
X printf("size: '$size'\n")
X printf("width: 1\n")
X printf("hcolor: none\n")
X printf("hwidth: 0\n")
X printf("background: none\n")
X printf("border: none\n")
X printf("opaque: no\n")
X printf("\n")
X printf("text:%s\n",$3)
X printf("\n")
X}' ${sites} > $labels
X
Xecho ""
Xecho "use d.paint.labels to display this label file"
END_OF_FILE
if test 1728 -ne `wc -c <'s.labels'`; then
echo shar: \"'s.labels'\" unpacked with wrong size!
fi
# end of 's.labels'
fi
echo shar: End of shell archive.
exit 0