[GRASSLIST:7961] Re: v.out.ascii - vertices in a line

Dylan Beaudette dylan at iici.no-ip.org
Wed Aug 17 17:25:04 EDT 2005


On Wednesday 17 August 2005 12:27 pm, Maciek Sieczka wrote:
> Hi
>
> I need to craft an ascii vector file, where the first and last vertex are
> given in one line, like in this example:
>
> 885.824 634.545 874.954 452.858
> 874.954 452.858 910.670 327.075
> 910.670 327.075 1013.160 219.927
>
> instead of what v.out.ascii  format=standard gives:
>
> 885.824 634.545
> 874.954 452.858
> 910.670 327.075
> 1013.160 219.927
>
> How can I do it? Please help me.
>
> Maciek

my first thought is awk ...

v.out.ascii | awk '{script here}'

i have done the opposite -- convert x,y into line segment data from GPS 
points.
here is how i did it (rather hackish...) walk1.raw contained x,y pairs.

--------------------
awk '
BEGIN {print "VERTI:" ; n = 0} 
{
vertex = $6" "$7
if(  (n > 0 && n < 3) ) 
   {
   print "L 2\n"old_vertex"\n"vertex
   } 
   else if(n >2 ) 
   {
   print "L 2\n"old_vertex"\n"vertex
   }
old_vertex = vertex
n++
}
' walk1.raw > walk1.ascii
-----------

then imported walk1.ascii with v.in.ascii


also, Hamish  once suggested looking at the v.in.garmin.sh script for ideas...

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list