outline of region (wish list)

Scott Wade wade at vinny.cecer.army.mil
Wed Nov 24 13:33:56 EST 1993


  grassu-list:

  Ronald Wiemer, ARCHIS, The Netherlands (ronald at archis.nl),
  recently shared a shell script that can quickly display
  the outline of the current region.  
  
  I used his script as the basis of a script that can be used
  to display the outline of any region stored in a windows directory
  in the current mapset searchpath.  This might be useful to outline
  areas of interest ('insets') or to help find predefined areas.

  Usage:   d.region.sh region_file color

  Default drawing color can easily be changed by editing line 3.

  This is just a simple Bourne shellscript and it might have some bugs.
  Any feedback would be appreciated.

  - Scott Wade   wade at vinny.cecer.army.mil

  ---8<-----cut here-----8<---------------
:

DEFCOLOR=white

if [ ! "$GISBASE" ]
  then
  1>&2 echo
  1>&2 echo "Error:   must be in GRASS to use `basename $0`"
  1>&2 echo
  exit
fi

case $# in
 1|2) REGION=$1;
      case $2 in
       red|orange|yellow|green|blue|indigo|white|black|brown|magenta|aqua|gray|grey) COLOR=$2;;
       *) COLOR=$DEFCOLOR;1>&2 echo;1>&2 echo "Using default color $DEFCOLOR";1>&2 echo;;
      esac;;
 *)   1>&2 echo;1>&2 echo "Usage:   `basename $0` region_file color";1>&2 echo;exit;;
esac

eval `g.findfile element=windows file=$REGION`
    
if [ "$file" ]
  then
  eval `g.region -gu region=$REGION`
else
  1>&2 echo
  1>&2 echo "Error:   no region file called $REGION"
  1>&2 echo
  exit
fi

d.mapgraph color=$COLOR << EOF
  move $w $s
  draw $e $s
  draw $e $n
  draw $w $n
  draw $w $s
EOF



More information about the grass-user mailing list