You are on page 1of 8

IPC_Grams_02-013.

qxd 6/6/03 4:47 PM Page 767

A Fast Algorithm for


Approximate Viewshed Computation
David Izraelevitz

Abstract
Given a terrain model, the viewshed from a viewpoint is computed as the set of X-Y positions of a point target such that
the target is visible. We introduce a novel approach to the
computation of accurate viewshed approximations. Our algorithm relies on the computation of an approximation to
the so-called line-of-sight (LOS) function. This function is defined over target X-Y positions, and is the highest elevation
of a target so that it is still occluded from the viewpoint. The
LOS function summarizes intervisibility information and permits reuse of previous intervisibility computations, resulting
in computational efficiencies. Our algorithm gives results
very close to the traditional sightline ray method at a substantially smaller computational cost, and is a generalization
of the approach developed by Franklin and Ray for the same
problem. We describe in detail the application to gridded
terrain models, but the approach is similarly applicable to
other elevation models.

Introduction
Computing the viewshed of an observers viewpoint is a common requirement for military, land management, architectural, simulation, and many other applications (Travis et al.,
1975; Goodchild and Lee, 1989; Franklin et al., 1994; Nagy,
1994; Zalevsky et al., 1999). Algorithms have been developed
for the triangulated-irregular network representation of digital
elevation models (e.g., Lee, 1991; Floriani and Magillo, 1997)
as well as gridded representations (Anderson, 1982; Sorensen
and Lanter, 1993; Franklin et al., 1994; Wang et al., 2000),
In this paper we concentrate on algorithms for deriving
viewsheds from the latter representation. We will describe in
detail the case of uniformly gridded models, where the spacing between grid locations is the same, but we will briefly
discuss the extension to irregularly (e.g., multiresolution)
gridded models.
Most published algorithms follow the same general
strategy for viewshed computation; see, for example, the R3
algorithm (Sorensen and Lanter, 1993; Franklin et al., 1994).
The elevation profile along the direction joining the viewpoint and each grid position is determined by appropriate
interpolation of the grid, and an intervisibility analysis is
performed along this profile. In this paper, we will consider
this direct method approach to be our gold standard because it makes full use of the available elevation data and is
the standard method for determining intervisibility.
The above algorithm requires computations proportional to N 3 for an N by N grid, because they require the direct examination of up to N points to determine occlusion
between the viewpoint and each of the N 2 grid positions.
The standard method for interpolation of the elevation data
is bilinear interpolation although other interpolation
schemes have been suggested as well (Yoeli, 1985).
TEC/Engineering Research and Development Center, U.S. Army
Corps of Engineers and SRI International, 660 Totavi Street, Los
Alamos, NM 87544 (david.izraelevitz@sri.com).

PHOTOGRAMMETRIC ENGINEERING & REMOTE SENSING

Notable exceptions to the direct method presented in the


literature are the R2 and Xdraw algorithms (Franklin et al.,
1994) and a variant of the Xdraw algorithm discussed in
Wang et al. (2000). These algorithms require computations
proportional to the number of grid elements, resulting in
substantial computational savings, a property shared by our
approach. In the R2 and Xdraw algorithms, computations
from previous intervisibility analyses are used to assist subsequent computations, resulting in reduced total computational cost. One contribution of our approach is that we
show how to incrementally adjust the accuracy of these approximate methods by increased computation, while the R2
and Xdraw algorithms have a fixed approximation error that
is dependent on the smoothness of the elevation data. The
R2 algorithm also presumes a priori knowledge of the maximum range to which we are interested in computing the
viewshed. As we will discuss, both the Xdraw and our present approach work incrementally from the viewpoint, permitting adaptive termination of the viewshed computation.
The paper is organized as follows: we first describe in
more detail the direct approach to viewshed computation
and formally introduce the concept of the line-of-sight or
LOS function. In the next section, we review the Xdraw
algorithm as a way of introducing our new approach. We
then illustrate the performance of our approach and compare it with the direct and Xdraw algorithms. We close
with some final observations and future work.

Notation and Preliminaries


The viewpoint pv is defined as the three-dimensional position of the sensor or observer, with conventional Cartesian
coordinates determined according to a coordinate system
where X and Y refer to metric ground coordinates and Z to
elevation above the X-Y plane. Thus, we will assume that
any conversions from other coordinate representations
such as geographic coordinates and compensation for Earth
curvature have been performed as a preprocessing step. A
typical target point is similarly denoted as pt.
For any three-dimensional vector p, we will define the
Z-coordinate or elevation of this point as elev(p). The
Euclidean distance between two points will be denoted by
p  q. Finally, we will presume that an interpolation
scheme has been defined as part of the elevation model so
that the terrain elevation model is defined for any point on
the X-Y plane. This continuous terrain elevation surface
will be denoted by S(X, Y). As a short-cut notation, we
will also define S(p) as the terrain elevation at the location
given by the projection of p on the X-Y plane, i.e., the terrain elevation under p.
Photogrammetric Engineering & Remote Sensing
Vol. 69, No. 7, July 2003, pp. 767774.
0099-1112/03/6907767$3.00/0
2003 American Society for Photogrammetry
and Remote Sensing

July 2003

767

IPC_Grams_02-013.qxd 6/6/03 4:47 PM Page 768

Direct Method for Viewshed Computation


The basic condition for intervisibility depends on whether
the line joining pv and pt, the sightline ray, intersects the
terrain elevation model. Consider an arbitrary point p along
the sightline ray joining pv and pt. A visibility obstruction
at the projection of p on the X-Y plane does not occur if the
following intervisibility condition holds for all such p:
S(p)  elev(pv ) 

 p  pv 
(elev(pt )  elev(pv )).
 pt  pv 

(1)

Because the relation above is a strict inequality, we will


consider that a sightline ray tangent to the terrain elevation
surface implies occlusion of the target by the terrain. Finally,
we may ask whether the above relation also holds at the endpoints of the sightline ray, i.e., at p  pv and p  pt. At these
points, the above relation implies that S(pv)  elev(pv) and
S(pt) , elev( pt). Because in any practical situation the target and viewpoint are above the terrain, we may consider
Equation 1 to hold at the endpoints as well.
We can also rearrange the above equation in the following form:
elev(pt )  elev(pv ) 

 pt  pv 
(S(p)  elev(pv )).
 p  pv 

768

July 2003

elev(pt )  elev(pv ) 

 pt  pv 
(S(pk)  elev(pv ))
 pk  pv 
for k  1, p, K

(2)

We can interpret this form of the relation as a condition on the elevation of the target. If the target elevation is
greater than the right-hand side of above relation, then the
terrain elevation at the projection of p on the X-Y plane
does not present an obstacle to intervisibility. We note that
this relation also holds at p  pt, and at p  pv by use of a
limit argument. This second form of the intervisibility condition is the key to the algorithms described in this paper.
Strictly speaking, one should check the condition in
either of the above relations at the continuum of points p
along the sightline ray. However, all computational approaches check the visibility condition at a finite number
of sample points along the sightline ray. A usual sampling
scheme is to choose points along the sightline ray that permit quick interpolation; for example, it is common to use
points along the sightline whose X-Y projections align with
the terrain elevation model gridlines. This facilitates the
terrain interpolation process and is normally a dense
enough sampling scheme. A common further simplification
is to sample the sightline ray only along X-gridlines or
Y-gridlines depending on which orientation more densely
samples the sightline ray, as illustrated in Figure 1. Al-

Figure 1. In the direct method for viewshed computation, terrain elevation data (dark circles) is interpolated
at the intersection of the X-Y projection of the sightline
ray with gridlines oriented along whichever direction results in greater sampling. In the illustration, the interpolation occurs along Y-gridlines.

though this is the sampling scheme we follow in this paper,


our general approach can be easily applied to schemes where
the sightline ray is sampled at each X-gridline or Y-gridline
intersection, or other schemes that sample the sightline ray
more densely.
In the direct method, the intervisibility of the viewpoint with each target point is considered independently.
A possible target position is specified by adding the nominal target height above the ground to the terrain elevation
at each grid location. A sightline ray is then constructed
joining the viewpoint and target position, the terrain elevation profile aligned with the resulting sightline ray is sampled, and the condition (Equation 1 or 2) is checked.
Let the sightline ray be sampled at K  1 intermediate
points between pv and pt, where p0  pv and pK  pt as illustrated in Figure 1; applying the intervisibility condition
at each pK sample leads to the following set of K conditions
for a clear line-of-sight between the viewpoint and the target position:

(3)

Although the condition for k  K is satisfied trivially,


we include it for later notational simplicity.
In the next section we will show how to arrange the
above computation to facilitate reuse of intermediate results.

Viewshed Computation Using the Xdraw Algorithm


An approximate viewshed algorithm, called Xdraw, was developed in Franklin et al. (1994), and was subsequently analyzed in Wang et al. (2000). The algorithm gives good results
for densely sampled terrain elevation models. It is also quite
fast because it performs a small constant number of computations per grid element. Because our approach is an extension
of this algorithm, we begin by discussing it in some detail.
We begin by defining the LOS function as the maximum
value achieved by the right-hand side of the previous equation (Franklin et al., 1994): i.e.,
L(pt; pv )  elev(pv )  max

k1,p,K

pK pv 
(S(pk )  elev(pv )). (4)
 pt  pv 

We can interpret the LOS function L(pt; pv) as the maximum height of a target at the same X-Y position as pt so
that it cannot be seen from the viewpoint at pv (Figure 2).

Figure 2. Sequential computation of the LOS function.


The terrain elevation is shown as a thick line. The thin
line extending above it is the corresponding LOS function
value. An incremental sightline analysis is performed to
update L(pk; pv) from L(pk-1; pv) and S(pk).

PHOTOGRAMMETRIC ENGINEERING & REMOTE SENSING

IPC_Grams_02-013.qxd 6/6/03 4:47 PM Page 769

Strictly speaking, the LOS function is dependent on the X


and Y coordinates of pt but is independent of the Z-coordinate. However, it does depend on the X, Y, and Z coordinates of pv. Evaluating the case of k  K, we find that L(pt;
pv)  S(pt), i.e., the LOS function as a function of target position is always greater than or equal to the terrain elevation surface.
We now describe an alternate formulation of the intervisibility condition based on computing the LOS function
directly. This approach forms the basis for the Xdraw fast
viewshed algorithm, on which our own algorithm is based.
A key property is that the LOS function L(pK; pv) can be
computed from L(pK1; pv) (see Appendix A for a derivation of this relation): i.e.,

 pK pv 
(L (pK1; pv) elev(pv )), S(pK )d . (5)
 pK1  pv 

There is nothing special about the case k  K, so the


above relation can be extended to the computation of any
intermediate L(pK; pv) from the previous L(pK1; pv): i.e.,
L(pk; pv )  max c elev (pv ) 

 pk  pv 
 pk1  pv 

(L(pk1; pv )  elev (pv )), S(pk ) d .

(6)

Essentially, the LOS function completely summarizes


all the information that is needed about the elevation profile earlier in the sightline ray, and the L(pk; pv) set can be
computed sequentially using L(p1; pv)  S(p1) as an initial
condition.
Once L(pt; pv) is computed by the method above, it is
trivial to determine whether a target at pt is visible. We simply compare L(pt; pv) to elev(pt). If the target is located above
the LOS function, then it is visible from the viewpoint.
The sequential computation of the LOS function does
not necessarily provide any clear computational advantage
over the direct method, because there are still computations of order N per grid location required to compute the
LOS function at each such grid location. There are some
cases, however, where one can see that the LOS function
method provides some computational advantages. Suppose
that we are computing the viewshed only at those grid locations that are oriented along the X-axis with respect to a
viewpoint located at the origin of the grid (0,0). Instead of
determining visibility at each grid location separately, we
can use the sequential approach to incrementally compute
the LOS function. We first compute the LOS function for
grid locations adjacent to the view location, and incrementally compute the LOS function for grid locations farther
away. The number of computations required to compute
the viewshed along this direction then becomes proportional to the number of grid locations along this axis, i.e.,
N instead of N 2. We can make a similar argument for computing the LOS function for grid locations oriented along
the Y-axis or along any of the |X |  |Y | directions.
A final observation is that the LOS function approach
permits more flexibility than does the direct approach
because the target height need not be specified a priori.
Thus, one can quickly analyze the change in the viewshed as
the target height is varied. Such flexibility may be attractive
in some applications such as tower placement. One may
want to know the maximum tower height that is still not visible from a key location as a function of tower placement.
PHOTOGRAMMETRIC ENGINEERING & REMOTE SENSING

L(pk; pv )  max c elev (pv ) 

 pk  pv 
 pk1  pv 

(L(pk1; pv )  elev(pv )), S(pk ) d

L(pt; pv )  L(pK; pv )  max c elev(pv )




The Xdraw algorithm makes primary use of the LOS


function approach. Although the one-step sequential computation of the LOS function is only exact when computing
the LOS function for grid locations oriented along the X, Y,
and diagonal directions, and only for viewpoints that lie
exactly on grid locations, the authors extend this approach
by the use of interpolation. Using previously computed LOS
function values, they interpolate the LOS function as needed
to generate an approximation to L(pK1; pv). Thus, the Xdraw
algorithm does not compute the true LOS function but rather
an approximation L9(pt; pv): i.e.,

(7)

where L9(pK1; pv) is the previously computed approximation to L(pK1; pv).


To illustrate the algorithm, consider a target location pt
where the estimate L9(pt; pv) of the LOS function is being
computed. We organize our computation of L9(pt; pv) in
successive stages, for example, calculating the LOS function
along concentric square rings emanating from pv such that
when L9(pt; pv) is to be computed, L9(p; pv) at all grid locations closer to pv have already been calculated, as shown in
Figure 3.
For a given target position pt  pK, consider the sample
along the sightline ray nearest to pK, given by pK 2 1, as shown
in Figure 4. Previously computed values of L9(p; pv) in the
neighborhood of L9(pK1; pv) are used to compute L9(pK1; pv).
In our implementation, we use the values of L9(pa; pv) and
L9(pb; pv) where pa and pb are grid locations that straddle
pK21. These points are used to estimate the required LOS
function value L9(pK1; pv) by linear interpolation. Finally,
we use this computed L9(pK1; pv) to generate L9(pt; pv).

Figure 3. In the Xdraw method, the LOS function is computed in stages arranged as concentric squares centered on the view location.

July 2003

769

IPC_Grams_02-013.qxd 6/6/03 4:47 PM Page 770

Figure 4. In the Xdraw method, the LOS function is interpolated once for the sample nearest the target location
(open circle). Values of the LOS function for grid intersections in the grey area have already been computed, and
thus are available to be used for interpolation.

Using this sequential approximation to the LOS function


results in a constant number of computations per grid location; therefore, the total computational cost becomes proportional to N 2. The accuracy of this approach depends solely on
how well L9(pK1; pv) approximates the true value L(pK21; pv).
In the next section we extend this approach in order to develop more accurate approximations to this value.
The Xdraw algorithm has been criticized for being subject to chunk distortion, an effect first discussed in Teng
and Davis (1992) and subsequently revisited in Franklin et al.
(1994). If we consider a single sightline analysis, such as
illustrated in Figure 1, one may argue that intervisibility
should only depend on the elevation value at those grid locations that straddle the sightline, which may be called the
neighbor set to the sightline ray. The Xdraw algorithm does
not satisfy this criterion, because the LOS function interpolation depends on LOS function values that have in turn
been computed from elevation points that are outside this
neighbor set. Our algorithm also has this property, so it is
appropriate to consider the effect of this chunk distortion.
Although chunk distortion may at first seem to be an
unacceptable dependence of the results on irrelevant data, it
is not clear, upon further reflection, that such dependence
should necessarily be a hindrance to accurate results. For
example, the direct method itself may depend on points outside the above-defined neighbor set if a more elaborate elevation interpolation scheme is used, such as cubic or spline
interpolation. Thus, we have not concerned ourselves in this
paper with how to avoid this dependence. In our specific
application we are concerned with the approximation properties of the LOS function. We argue that the only criterion
for the utility of the algorithm is how well it generates this
approximation, regardless of which portions of the elevation
dataset are used for this computation. The relative accuracy
and computational cost of different elevation and LOS function interpolation schemes is a topic for future research.

approach, we discuss below another case where the LOS


function update approach can be used to reduce the amount
of computation. Because we have identified the LOS function
interpolation step as the source of the approximation error,
we look for other cases where this interpolation is avoided.
Consider the example in Figure 5, where the sightline
ray samples coincide with the grid at every other sample.
Presuming that the LOS function has already been computed for all grid locations closer to the view location than
the target, we do not need to start the sequential computation of the LOS function at the view location. Rather, we
have to start at the last ray sample that coincides with the
grid because, at that location, the necessary value of the
LOS function has already been computed and there is no
need for interpolation.
The new algorithm is based on this critical observation.
Instead of starting the LOS function computation from the
view location or interpolating the LOS function and then
performing a single update as in the Xdraw algorithm, we
begin the computation several samples back at M  K, incurring an interpolation error of the LOS function at an earlier step closer to the viewer, but not accumulating any more
errors. Although beginning this computation at an earlier
sample results in greater computational cost, we find that
the approximation error is substantially reduced because
the number of LOS function approximations is reduced, resulting in a final product very close to the direct method but
at a smaller cost.
We compute the LOS function employing the same incremental approach used by the Xdraw algorithm, illustrated
in Figure 3. Consider again the sampling scheme shown in
Figure 1, modified to stop the sampling at M  K samples
back along the sightline ray. If one of these M samples falls
exactly on the grid, then we use the previously computed
value of the LOS function at that location and begin the computation of subsequent values of the LOS function towards
the target. If none of the samples lie on the grid, then we
are forced to interpolate the LOS function at the (K  M )th
sample location, incurring the error cited above, and begin
the computation at that point (Figure 6). Because we start
the computation M steps back, we call M the backtracking
order for this algorithm. Note that, because of how the LOS
function values are sequentially computed, we are assured

Viewshed Computation by Backtracking


Recall that the reason why the LOS function update approach, although exact, does not provide any substantial
computational advantage over the direct method is because
the LOS function values computed for one sightline analysis
are not typically reused for analysis of a subsequent viewtarget pair. As discussed in the previous section, one exception is given by the case of sightline rays that are oriented
in cardinal or diagonal directions, and where the viewpoint
falls on a grid location. As an introduction to our general
770

July 2003

Figure 5. The previously computed LOS function value


can be used to avoid examining terrain elevation data
earlier in sightline analysis.

PHOTOGRAMMETRIC ENGINEERING & REMOTE SENSING

IPC_Grams_02-013.qxd 6/6/03 4:47 PM Page 771

For target locations that do not satisfy the above conditions, however, there will be some interpolation of the LOS
function, thus resulting in some error. For those target locations that satisfy 2M  K, the calculated LOS function
value will depend on a single new LOS function interpolation. Moreover, this interpolation is computed from two
straddling grid locations for which the LOS function value
was computed without any approximation. Following this
argument, we see that the accumulation of LOS function errors is generally greatly reduced for a backtracking order M
much greater than 1. In fact, if the target location satisfies
kM  K, the number of LOS function interpolations that
were required will be at most k  1. In contrast, the Xdraw
algorithm requires K LOS function interpolation steps.

Computational Examples

Figure 6. The new approach interpolates the LOS function (grey circle) in order to start the LOS function computation (backtrack order of 3).
that we always have the previously computed LOS function
available for the interpolation step.
Thus, the calculation of L9(pt; pv) in our algorithm is
essentially the same as the original LOS function formula,
except that we start the computation at k  K  M rather
than at k  1: i.e.,
L(pk; pv )  max c elev (pv ) 

 pk  pv 
(L(pk1; pv)
 pk1  pv 

 elev (pv )), S(pk ) d for k  K  M  1, p , K

(8)

In our experiments, the value of L9(pK2M; pv) required


for initialization is given by linear interpolation of the LOS
function at pK2M using the straddling grid locations, just as
in the Xdraw algorithm. Note that, for a backtracking order
of 1, our approach is exactly equivalent to the Xdraw algorithm. We can expect that using our approach with a backtrack order greater than 1 will result in a better accuracy
than that for the Xdraw algorithm for several reasons, although a mathematical analysis determining the conditions
for such improvement appears difficult, and in fact under
rare conditions, increased backtracking order may not increase accuracy.
First of all, it is clear that the LOS function computed
using our method at all those locations where our algorithm
has an exact initial value results in exact computation of
L(pt; pv), because for those locations we are essentially invoking the direct method. Second, there is a reduction in
the number of LOS function approximation steps that reduces
the error accumulation in our approach compared to the
Xdraw algorithm. We can follow the accumulation of errors
in the LOS function estimate to get an idea of the resulting
approximation errors. The number of elevation samples
along the sightline ray between pt and pv using the sampling
scheme described earlier is K, where K is given by the maximum number of X or Y gridlines between pt and pv. Those
locations such that the backtracking order M is greater than
K will have the value of the LOS function computed without
any approximation, because the backtracking goes all the
way back to the viewpoint and therefore has an exact LOS
function initializer. Furthermore, if one of the M samples
falls exactly on the grid, then we will use that sample to
initialize the computation, rather than going back the full M
samples. Because in this case we are not performing any LOS
function interpolation either, the result will again be the
same as in the direct method.
PHOTOGRAMMETRIC ENGINEERING & REMOTE SENSING

In this section we illustrate the performance of the new approach. We compare the results of applying the different
viewshed algorithms discussed in this paper, and we investigate the behavior of the approximation error and computational cost of the new algorithm as we change the backtrack order.
Figure 7a shows a shaded relief representation of the
DEM dataset that was used in these experiments. It covers
an area of 8 km by 8 km over the U.S. Army National Training Center at Fort Irwin, California, collected at a 10-meter
post separation and a 1-meter vertical resolution. Overlaid
on this plot are 16 view locations placed in a grid with a
spacing of 160 meters and used to analyze the relative accuracy and computational requirements of the algorithm
presented in this paper. The terrain used in this example
includes a variety of terrain features from wide valleys to
hills rising 700 meters above the valley.
For each of the viewpoints, we first computed the viewshed using the direct method and assuming an observer
and target height of 2 meters above the ground. Figure 7b
illustrates a typical viewshed computed for this region.
The light shade corresponds to visible regions, while the
darker shade corresponds to obscured regions. The long
thin shadow is due to a mound oriented southeast of the
viewpoint and is not a processing artifact. It is however, illustrative of some of the subtle viewshed characteristics
that may be missed by approximating algorithms.
We then processed the same region using the algorithm
described in this paper, while varying the backtrack order
M. Figure 8 illustrates the effect of increasing M in our algorithm. We see that subtle features of the viewshed begin
to be included as M is increased.
Note the long thin shadow that is prominent in the
viewshed computed by the direct method. This subtle
viewshed feature is only properly computed at higher backtrack orders and is mostly missed by the Xdraw algorithm.
As a quantitative evaluation of the approximation errors incurred by our method, we computed a classification
error rate for each of the 16 viewpoints, by dividing the
total number of grid locations misclassified as visible or not
visible by the total number of grid locations in the dataset.
Figure 9 shows the decrease in classification error for each
viewpoint as the backtrack order is increased.
We see that in all cases examined, setting the backtrack
order M  1 uniformly decreases the classification error,
most often in a significant manner. Figure 10 shows the effect of increasing M even further. Here we have set M to a
multiple of 5 up to 40, and we plot the minimum, median,
and maximum classification error as a function of backtrack order.
We see that the classification error generally decreases
as a function of backtrack order. However, it is not guaran-

July 2003

771

IPC_Grams_02-013.qxd 6/6/03 4:47 PM Page 772

(b)

(a)

Figure 7. Sample dataset used for the experiments. (a) Shaded relief. (b) Typical viewshed.

(a)

(b)

(c)

Figure 8. Viewshed as a function of backtrack order. (a) Backtrack order 1 (Xdraw). (b) Backtrack order 5. (c) Backtrack
order 10.
teed that increased backtrack order will uniformly decrease
classification error. In this case, a backtrack order of 25
seems to have better median performance than a backtrack
order of 30, although accuracy resumes its improvement
with higher backtracking orders. Generally, we have found
that increased backtrack order reduces classification errors
in almost all cases.
Finally, Figure 11 shows the minimum and maximum
CPU time required to calculate the viewshed using the approach described in this paper on a 300 MHz Pentium II.
Although the computational time can be expected to change
dramatically with software implementation and computer
hardware, the figure illustrates some general characteristics.
As expected, we see that the CPU time increases linearly with backtrack order. We also recorded the CPU time
772

July 2003

to compute the viewshed using the direct algorithm. For the


viewpoints chosen, the CPU time used for the direct method
ranged from 69 to 96 CPU seconds with a median time of
84 CPU seconds. Thus, even relying on a high backtrack
order, our algorithm is substantially faster than the direct
approach, in this case by almost an order of magnitude.

Final Comments
We introduce in this paper a new algorithm for computing
viewsheds that provides a bridge between the direct method
based on sightline analysis and the fast, but less accurate,
Xdraw method introduced by Franklin and Ray. Our algorithm is substantially faster than the direct method and
yields very similar results. Because the computational cost
for each sightline ray depends on the square of the number
PHOTOGRAMMETRIC ENGINEERING & REMOTE SENSING

IPC_Grams_02-013.qxd 6/6/03 4:47 PM Page 773

Figure 9. Classification error as a function of backtrack


order up to backtrack order of 5.

of its elevation samples, the computational cost of the direct


method is governed by the longest sightline rays because
they have the largest number of elevation samples. Thus,
the computation of viewsheds for observers along the edge
of the elevation dataset will take longer than the computation of the viewshed for an observer in the center of the
dataset when using the direct method. In contrast, the computational cost of our algorithm is essentially the same for
any observer location and is linear in both the number of
grid elements and the backtrack order.
We close with several areas of future work. We noted
earlier that our approach could be extended to other sampling methodologies, for example, where the sightline ray
is sampled at every intersection of the ray with the horizontal and vertical gridlines. More generally, there are other
direct extensions of the algorithm as presented here. First
of all, interpolation schemes other than bilinear interpolation may be used for both the elevation data and the LOS
function. The proper interpolation strategy may be different for each case and is an area of current research.
Moreover, elevation model representations other than
the uniformly gridded representation studied here may be
used. The basic computation in our algorithm consists of
two distinct steps: computation of an approximation to the
LOS function, and the sampling and interpolation of the elevation data along the sightline. It is safe to say that computing the elevation height at a given location is a function
supported by any terrain representation, including multiresolution representations and triangulated irregular networks. A similar scheme may be used to represent the LOS
function as it is computed.
Finally, a comparison of the computational requirements and accuracy characteristics of our approach versus
the R2 algorithm, whose order of computation is similar to
ours, is another potential area of future work.

Acknowledgments

Figure 10. Range of classification error as a function of


increased backtrack order for larger backtrack orders.

The author would like to thank Mr. Maurice Gyer for a careful review of the initial version of this paper. Mr. Michael
Powers and Mr. Kenneth Braswell of the TEC/Engineering
Research and Development Center of the U.S. Army Corps
of Engineers supplied the data used to evaluate the algorithm presented here and provided the initial impetus for
the resulting research. The author would also like to thank
Mr. Michael C. Stein for many interesting discussions on
the utility of visibility algorithms in terrain analysis that
directly motivated this work. The careful review of the
paper and many thoughtful comments by the anonymous
reviewers is gratefully acknowledged.

References

Figure 11. Range of CPU time as a function of backtrack


order.

PHOTOGRAMMETRIC ENGINEERING & REMOTE SENSING

Anderson, D.P., 1982. Hidden line elimination in projected grid


surfaces, ACM Transactions on Graphics, 1:274291.
De Floriani, L., and P. Magillo, 1997. Visibility computations on
hierarchical triangulated terrain models, GeoInformatica,
1:219250.
Franklin, W.R., C.K. Ray, and S. Mehta, 1994. Geometric Algorithms for Siting of Air Defense Missile Batteries, Technical
Report DAAL03-86-D-0001, Battelle, Columbus Division,
Columbus, Ohio, 129 p.
Goodchild, M.F., and J. Lee, 1989. Coverage problems and visibility regions on topographic surfaces, Annals of Operations Research, 18:175186.
Lee, J., 1991. Analyses of visibility sites on topographic surfaces,
International Journal of Geographical Information Systems,
4:413429.
Nagy, G., 1994. Terrain visibility, Computer and Graphics, 18:
763773.

July 2003

773

IPC_Grams_02-013.qxd 6/6/03 4:47 PM Page 774

Sorensen, P.A., and D.P. Lanter, 1993. Two algorithms for determining partial visibility and reducing data structure induced
error in viewshed analysis, Photogrammetric Engineering &
Remote Sensing, 59:11491160.
Travis, M.R., G.H. Elsner, W.D. Iverson, and C.D. Johnson, 1975.
Viewit: Computation of Seen Areas, Slope, and Aspect for
Land-Use Planning, Technical Report PSW-11/75, U.S.D.A.
Forest Service, Berkeley, California, 70 p.
Teng, Y.A., and L.S. Davis, 1992. Visibility Analysis on Digital
Terrain Models and Its Parallel Implementation, Technical
Report CAR-TR-625, Center for Automation Research, University of Maryland, College Park, Maryland.
Wang, J., G.J. Robinson, and K. White, 2000. Generating viewsheds
without using sightlines, Photogrammetric Engineering & Remote Sensing, 66(1):8790.
Yoeli, P., 1985. The making of intervisibility maps with computer
and plotter, Cartographica, 22:88103.
Zalevsky, Z., S. Lashansky, A. Goldman, and T. Firdlander, 1999.
Model for estimating target detection ranges in the visible
spectrum, Proceedings of SPIE, 3716:194205.
(Received 29 January 2002; revised and accepted 02 October 2002)

or equivalently,
L(pK; pn)  max celev(pn) 
k1,...,K

pK  pn 
(S(pk)
pk  pn 

 elev (pn))d .

(A.2)

Breaking out the k  K term separately, we get


L(pK; pn)  max e

max

k1,...,K1

celev(pn) 

pK  pn 
(S(pk)
pk  pn 

 elev (pn))d , S(pk) f .

(A.3)

We now relate the inside maximization to L(pK1; pv): i.e.,


L(pK1; pn)  elev (pn) 

max

k1,...,K1

pK1  pn 
(S(pk)
pk  pn 

 elev (pn)).

Appendix A. Derivation of Sequential Computation Formula for


the LOS Function

Multiplying both sides of this equation by a constant,

In this section we show how to derive the sequential computation formula for the LOS function from its definition.
We begin with the definition for the LOS function: i.e.,

pK  pn 
(L(pK1; pn)  elev(pn))
pK1  pn 

L(pK; pn)  elev (pn)  max

k1,...,K

 elev (pn))

774

July 2003

pK  pn 
(S(pk)
pk  pn 


(A.1)

max

k1,...,K1

pK  pn 
(S(pk)  elev (pn))
pk  pn 

(A.4)

(A.5)

which leads to Equation 5 in the main text.

PHOTOGRAMMETRIC ENGINEERING & REMOTE SENSING

You might also like