[GRASSLIST:3351] Re: scripting help
Gordon Keith
gordon.keith at csiro.au
Wed Mar 20 17:54:16 EST 2002
On Wed, 20 Mar 2002 03:10, Kevin Slover wrote:
> I have exported a vector file using v.out.ascii. What I am trying to
> do is create a 3d vector file as can be used in GRASS5.1. How would
> one go about parsing the ascii vector file, using the L 5 as the
> splitter. For example, I have this:
> L 5
> 27.041325 -81.988854
> 27.04215 -81.988854
> 27.04215 -81.988029
> 27.041325 -81.988029
> 27.041325 -81.988854
> L 2
> 27.042149 -81.988853
> 27.039242 -81.985962
>
>
> and want to add on the 3rd dimension as height. Wouldn't be so
> difficult, however...I need to create several heights at each point
> such that it would look like:
>
>
> 27.041325 -81.988854 2
>
> 27.041325 -81.988854 3
> etc etc...
> I am basically wanting to create "barriers" as defined by the vector
> file. Any thoughts??
It's not at all clear to me what it is you are want.
awk '{ if($1 != "L") {print $1 " " $2 " " 2; print $1 " " $2 " " 3;} }'
will do something that would satisfy one interpretation of what you are
asking.
awk '{if($1=="L") {print $0} else {print $0 " " 2; print $0 " " 3;}}'
may also be what you're after, or perhaps even something like:
awk '{if($1=="L") {print "B " $2 * 2} else {print $0 " " 2; print $0 "
" 3;}}'
Hope there's enough there to point you in a useful direction.
Regards
Gordon
More information about the grass-user
mailing list