[GRASS-dev] GRASS 7: replace r.los with r.viewshed?

Hamish hamish_b at yahoo.com
Fri Dec 2 00:44:30 EST 2011


Michael wrote:
> How does r.viewshed differ from r.los?

basically it is faster and it scales to large regions well.

I don't know the exact O()ness level of it, but r.los becomes very quickly
slower after the region size gets bigger than a smallish amount of rows x
columns, to the point where it becomes unusable.

r.viewshed should be (*testing welcome) an option-for-option drop in
replacement for r.los written by Laura & co. in C++, from the same
family of code as r.terraflow. It has a detailed help page explaining
its algorithm.

from the code header comments:
 * The viewshed algorithm is efficient both in
 * terms of CPU operations and I/O operations. It has worst-case
 * complexity O(n lg n) in the RAM model and O(sort(n)) in the
 * I/O-model.  For the algorithm and all the other details see the
 * paper: "Computing Visibility on * Terrains in External Memory" by
 * Herman Haverkort, Laura Toma and Yi Zhuang.

additionally as a ray-tracing sort of problem it is ideally suited for
GPU acceleration using OpenCL support(?), along the same lines as Seth's
to-be committed r.sun + OpenCL. So it has a bright future.


also in this group of modules, but slightly different, there is/was the
r.cva module for cumulative viewshed analysis. Unfortunately (AFAIU) the
author could never convince the university he worked for to allow him
to release the code for that as GPL.


Hamish


More information about the grass-dev mailing list