[GRASS-windows] viewshed integration

Brian Sanjeewa Rupasinghe jinkabs at gmail.com
Sun Jan 6 10:26:35 PST 2013


Hi all,

I am going to calculate cumulative viewshed analysis by adding each
viewshed result of several observer locations
with r.mapcalc using Python. Observer locations are read from a file.
GenerateViewshed method is executed inside the Iterate
File method (see the methods below). When i execute this it fails create
the output with following errors:

ERROR: Sorry, <r> is not a valid flag
ERROR: Sorry, <o> is not a valid flag
ERROR: Sorry, <u> is not a valid flag
ERROR: Sorry, <t> is not a valid flag
ERROR: Sorry, <p> is not a valid flag
ERROR: Sorry, <u> is not a valid flag
ERROR: Sorry, <t> is not a valid flag
ERROR: Sorry, < > is not a valid flag
ERROR: Sorry, <=> is not a valid flag

and in the command console

Command 'd.rast map=brian at PERMANENT' failed
Details: Unknown display driver <cairo>

The name of the output file i gave is brian which is referred by parameter
routput in GenerateViewshed method. Any idea on the errors??

Cheers, Brian

----Python code-------------

def IterateFile(infile):

    i=0
    for line in fileinput.input(infile):
        values = string.split(line,",")
        pid = values[0]
        print pid
        e = values[2]
        print e
        n = values[1]
        print n
        z = values[3]
        print z
        GenerateViewshed(e,n,1.5,25,i)
        i = i + 1

def GenerateViewshed(x,y,oelv,th,i):
    grass.run_command('r.viewshed', input = rinput, output = 'viewshed',
coordinate = [x,y], obs_elev = oelv, tgt_elev = th, memory = 4098,
overwrite = True, quiet = True)
    if i==0:
        grass.run_command('r.mapcalc', 'routput = viewshed + 0', overwrite
= True, quiet = True)
    if i>=1:
        grass.run_command('r.mapcalc', 'routput = viewshed + routput',
overwrite = True, quiet = True)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-windows/attachments/20130106/efc73359/attachment.html>


More information about the grass-windows mailing list