Easy question/v.in.ascii

Referring to my message of 13 Jul 94 (Real easy question) and Darrell McCauley's
reply on 13 Jul 94 (Re: Real easy question), I looked at v.in.ascii and it
appears to convert an existing map layer in ascii format to a map layer in
binary format. What I need to do is convert an ascii text file consisting
of lat lon in two columns to a vector map layer. As far as I can tell from
the manual, v.in.ascii will not do this. Does anyone know what will?

-Stephen Dzurenko
Ocean Mapping Division
Ocean Technology Center
Graduate School of Oceanography
University of Rhode Island

ph: 401 792-6853
fx: 401 792-6849
e-mail: steve@ocesun1.oce.uri.edu

Steve Dzurenko (steve@ocesun1.oce.uri.EDU) writes on 13 Jul 94:

Referring to my message of 13 Jul 94 (Real easy question) and Darrell McCauley's
reply on 13 Jul 94 (Re: Real easy question), I looked at v.in.ascii and it
appears to convert an existing map layer in ascii format to a map layer in
binary format. What I need to do is convert an ascii text file consisting
of lat lon in two columns to a vector map layer. As far as I can tell from
the manual, v.in.ascii will not do this. Does anyone know what will?

awk will do it - no problem. Try running v.out.ascii on a spearfish
vector file. Look at the format - v.in.ascii expects the data to be
in this format. Then (this is just sketchy pseudo-code)
write a quick little awk program:

BEGIN { n=0;
        printf "ORGANIZATION: oce.uri.edu\n";
        printf "DIGIT DATE: ...
        ... /* do rest of header stuff */
      }
{
  if ($0 != "") /* we'll assume that polygons/lines are separated by
                   a blank line */
  {
     printf "A %d\n", n; /* assume coordinates are area edges */
     for(i=0;i<n;++i)
       printf " %f %f\n", x[i],y[i]; /* format specifiers may have to
                                       be adjusted to conform to standards */
     n=0;
  }
  else
  {
    x[n]=$1; y[n++]=$2;
  }
}

Now, if these lat long coords are just points
and not area edges or lines, you can either
change the program

{
  printf "P 2\n" ;
  printf " %f %f\n %f %f\n", $1, $2, $1, $2;
}

OR use s.in.ascii, as Ken Sibley mentioned, and store
them as sites. Storage as vector may be more efficient,
depending upon the number of points you are talking about.

holler at me offline if you need help with awk.
--Darrell