v.in.arc in an easier way

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

v.in.arc in an easier way

Lars Schylberg

There has been a lot talking around the v.in.arc command lately.
Maybe it is not so easy to use, but I thing some problems are due to
the problems in arc/info.  I am no arc/info expert, but learned some
aml to survive.  I wrote this script last spring to make make the
export part in arc/info easier.  It is a Bourne shell script that
creates two aml scripts and runs arc info to do the ungenerate
commands and dumps info content with the two amls.  The script does
ungenerate both on lines and polygon data at the same time.  It up
to the user to decide then what to import when v.in.arc is used.
The script should be run from the unix prompt.

I called the script "m.export.arc.covers.sh".  I hope some people can be
helped by this script.  Please respond to me if you improve the script.

Lars Schylberg
National Land Survey of Sweden           Dept. of Photogrammetry
R&D Departmant                           Royal Inst. of Technology
S-80112 Gavle, Sweden                    10044 Stockholm, Sweden

[hidden email]                          [hidden email]

======== cut here ====== m.export.arc.covers.sh ================================
/bin/sh
#
#  m.export.arc.covers.sh
#
#  Export a arc coverages
#  put them in ungenerate files for import to GRASS
#
#  Author: Lars Schylberg ([hidden email]), 910626
#          National Land Survey of Sweden
#          Gavle, Sweden
#--------------------------------------------------------------------
# Input arguments:
# $1 : arc_cover
#
case $# in
0) echo 'Usage: '$0' arc_cover'; exit 2;;
1) ;;
*) echo 'Usage: '$0' arc_cover'; exit 2;;
esac
#
# fix file names for INFO
#
name=$1
name_aat=${name}.aat
name_pat=${name}.pat
NAME_AAT=`echo $name_aat | tr a-z A-Z`
NAME_PAT=`echo $name_pat | tr a-z A-Z`
CURRENT_DIR=`pwd`
#
# generate aml file to print aat to file
#
echo '&data ARC INFO
ARC
CALC $COMMA-SWITCH=-1
OUTPUT '${CURRENT_DIR}'/'${name_aat}'.txt
SELECT '${NAME_AAT}'
ITEMS PRINT
DISPLAY PRINT
Q STOP
&end' > aat.aml
#
echo '&data ARC INFO
ARC
CALC $COMMA-SWITCH=-1
OUTPUT '${CURRENT_DIR}'/'${name_pat}'.txt
SELECT '${NAME_PAT}'
ITEMS PRINT
DISPLAY PRINT
Q STOP
&end' > pat.aml
#
#  Do the ungenerate on lines, points and info content
#
arc << EOF2
ungenerate line $name ${CURRENT_DIR}/${name}.lin
ungenerate point $name ${CURRENT_DIR}/${name}.pts
&r aat
&r pat
quit
EOF2
#
echo Done
#
# do some cleaning up
#
/bin/rm aat.aml
/bin/rm pat.aml