[GRASSLIST:4199] connect the dots

Hello,
I have a series of LL coordinates, in a given order, that I imported in
GRASS57. I'd like to connect one site to another, for example in the category
order. What should I do ?
Thanks a lot in advance
P>

--
Soil & Water Laboratory
Dept. of Biological & Environmental Engineering
Cornell University
ITHACA, NY 14853
Tel: (607)255.2463

On Wed, 18 Aug 2004 07:36, SWlab wrote:

I have a series of LL coordinates, in a given order, that I imported in
GRASS57. I'd like to connect one site to another, for example in the
category order. What should I do ?

What I did (there may be a better method):

Export the sites as an ascii file,
reformat the file to the vector file format and
import the vector file.

The following script should more or less do the job:

# export the sites as an ascii file
v.out.ascii sitesname > sites.txt

# reformat the file to the vector file format
GISDBASE=`g.gisenv get=GISDBASE`
LOCATION_NAME=`g.gisenv get=LOCATION_NAME`
MAPSET=`g.gisenv get=MAPSET`
VECTFILE=$GISDBASE/$LOCATION_NAME/$MAPSET/dig_ascii/vfile.txt

echo VERTI: > $VECTFILE
echo L `cat sites.txt | wc -l ` >> $VECTFILE

awk -F \| '{ print " " $2 " " $1 }' sites.txt >> $VECTFILE

# import the vector file
v.in.ascii in=vfile.txt out=vectorname

This connects all the sites as a single line in the order they appear in the
sites file.

If you want more than one line you need to add a line consisting of L and the
number of points followed by the points to the end of the file. eg if
sites2.txt contains the second line add:
echo L `cat sites2.txt | wc -l ` >> $VECTFILE
awk -F \| '{ print " " $2 " " $1 }' sites2.txt >> $VECTFILE

You can obviously create the vfile.txt by hand, just remember it has to be in
the dig_ascii directory.

The man page for v.in.ascii should cover the details.

Hope this helps
Gordon
--

Gordon Keith
Programmer/Data Analyst
Marine Acoustics
CSIRO Marine Research
http://www.marine.csiro.au

The main thing is keep the main thing the main thing.

I have a series of LL coordinates, in a given order, that I imported
in GRASS57. I'd like to connect one site to another, for example in
the category order. What should I do ?

Make them into a GRASS ascii-vector file (verti type='L'ine) and import
with v.in.ascii.

see:
http://grass.ibiblio.org/grass57/manuals/html57_user/v.in.ascii.html
http://grass.ibiblio.org/gdp/html_grass5/ascii_formats.html

see the v.in.garmin.sh script in GRASS 5.3 for scripting ideas.

note for format changes slightly between 5.3 and 5.7.

Hamish