Integrated viewshed analysis

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Integrated viewshed analysis


I need to do integrated viewshed analysis of a target with several observer locations. I am going to use r.viewshed analysis function in GRASS. With this function, it is possible to perform analysis based on single observer location. My aim is to add output of each single observer location into integrated viewshed output. Each output, i am going to flag with -b where o denotes non-visible while 1 denotes visible. Through a loop of observer locations, output of viewshed of each location can be integrated with r.mapcalc function. After integration, values = 0 in the rater map dentoes non-visible areas and value >= 1 denotes visible areas. Under the loop of observer locations I just used r.mapcalc function with each viewshed adding. After getting the integrated viewshed raster, i need to extract its boundary depicting visible area in vector format. How to do that in GRASS?

Using IterateFile method, i read observer locations and with GenerateViewshed method, i calculate each single viewshed of a particular location. Then with r.mapcalc, i integrated all viewsheds. I want to find if r.mapcalc python code i have used is correct. If it is correct, how to extract the boundary of the visible area in vector format?

def IterateFile(infile):


    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


        i = i + 1


def GenerateViewshed(x,y,oelv,th,i):

    standard_DEM = options['standardDEM']

    output = options['outputmap']

    grass.run_command('r.viewshed', input=standard_DEM, output='viewshed',coordinate=[x,y], obs_elev=oelv, 


    if i==0:

        grass.mapcalc('output = viewshed + 0')

    if i>=1:

        grass.mapcalc('output = viewshed + output')

grass-windows mailing list
[hidden email]
Reply | Threaded
Open this post in threaded view

Re: Integrated viewshed analysis

Helmut Kudrnovsky
[maybe better asked in the grass-user ML]

> how to extract the boundary of the visible area in vector format? - Converts a raster map into a vector map layer:

    Feature type
    Options: point,line,area
    Default: line


best regards