[GRASS5] scripting help
Bernhard Reiter
bernhard at intevation.de
Tue Mar 19 11:45:10 EST 2002
Kevin,
please note that grass5.1 is experimental code
only aimed at developers. Thus most developers will not have the
time to answer user level questions.
Your chance of getting answers also rise if you do not post in html
as it is still considered impolite on this lists.
On Tue, Mar 19, 2002 at 11:10:44AM -0500, 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??
Any programming language with string processing capabilities will be
able to do the task. See this parsing example:
-----------
#! /bin/env python
"""" Per line processing example. """
import sys
import string
import fileinput
def process(line):
""" Process one inputline and spit out, what we want. """
# get rid of the possible newline and the whitespace around
# chars
line=string.strip(line)
if line and line[0]=="L":
l=int(line[1:])
sys.stderr.write("Found L=%d ignoring it\n" % (l) )
else:
sys.stdout.write(line+"\n")
for line in fileinput.input():
process(line)
-----------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 248 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20020319/ee88c3b2/attachment.bin
More information about the grass-dev
mailing list