[GRASS5] Tools for importing data from mapping servers

Markus Neteler neteler at itc.it
Wed Mar 8 06:50:05 EST 2006


On Wed, Mar 08, 2006 at 11:03:33PM +1300, Hamish wrote:
> > Issues: Doesn't write history. Anyone want to tell me the right way to
> > do this?
> 
> r.patch will write it's history (command line), but from a shell script
> there isn't a good way (yet). Writing a line to the history should be a
> command line option of r.support, but isn't yet.
>

For myself, I have simply added text to the hist file,
something like this

meta="metadata bla bla bla"

HISTFILE=$LOCATION/hist/$RASTERMAP
#determine total length:
STRINGLENGTH=`echo $meta | wc -c | awk '{printf $1}'`

#maximal allowed string length for GRASS hist file 62 chars:
#(max 20 lines accepted, rest silently truncated by GRASS modules)
LINELENGTH=62

#insert linebreaks, if needed
i=1
while [ $i -le $STRINGLENGTH ]
do
 NEXT=`expr $i + $LINELENGTH`
 echo $meta | cut -b$i-$NEXT >> $HISTFILE
 i=`expr $i + $LINELENGTH`
 i=`expr $i + 1` # need one more
done


Of course it's highly desired to get this added to r.support.

Markus




More information about the grass-dev mailing list