You are currently viewing a new version of our website. To view the old version click .
ISPRS International Journal of Geo-Information
  • Article
  • Open Access

28 September 2022

HiPDERL: An Improved Implementation of the PDERL Viewshed Algorithm and Accuracy Analysis

and
School of Computer Science and Technology, Nanjing Normal University, Nanjing 210023, China
*
Author to whom correspondence should be addressed.

Abstract

Terrain viewshed analysis based on the digital elevation model (DEM) is of significant application value. A lot of viewshed analysis algorithms have been proposed, including R3 as the accurate one and others as efficient ones. The R3 algorithm is accurate because of its comprehensive but time-consuming computation, while the others are efficient due to proper approximation. However, no algorithm is capable of taking advantage of both until one algorithm is proposed, which is based on a ‘proximity-direction-elevation’ (PDE) coordinate system and named the PDE spatial reference line (PDERL) algorithm. The original research proves the PDERL algorithm is perfectly accurate by theory and experimental results, in comparison with R3 as standard, and even more efficient than R3. However, the original research does not mention the cases where the observer is placed on grid points, and the original implementation does not produce very accurate results in practice. It is important to find out and correct the errors. In this paper, a checking algorithm for PDERL is proposed to allow further investigation of errors. With the fundamental ideas of PDERL unchallenged, an improved implementation of the PDERL algorithm is proposed, named HiPDERL. By experimental results, this paper proves HiPDERL utilizes the potential of PDERL on accuracy at the cost of a little efficiency when the observer is placed on grid points.

1. Introduction

Terrain visibility analysis is an important part of digital terrain analysis. The viewshed in a terrain refers to a distinct region of the terrain that can be seen at one or more specific positions within a certain range on the terrain, and viewshed analysis is the process to compute such viewshed, with the elevation value of a given location based on the digital elevation model (DEM) data [1]. Terrain viewshed analysis based on the digital elevation model is widely used in archaeological research [2], path planning [3], siting optimization [4], landscape analysis [5], military analysis [6], security monitoring [7], or combination with other grids for terrain description [8,9].
Terrain viewshed analysis computes the viewshed of a viewpoint at a certain position on the terrain. This position is taken as the viewpoint with an observer on it, and all positions within a certain range around the viewpoint are taken as the target points. By doing so, the viewshed analysis of the viewpoint is thus transformed into the intervisibility computation between the viewpoint and each target point. The general method for computing intervisibility is to connect the viewpoint and the target point to create a line-of-sight (LOS) and determine whether the target point is visible to the viewpoint, by studying whether the line-of-sight is blocked by the terrain [10], which is the fundamental basis of most viewshed computation algorithms. Commonly, considering the height of the observer, the actual elevation of the viewpoint may be slightly higher than the elevation of the position itself on the DEM.
A lot of algorithms have been proposed for viewshed analysis, including R3 as the accurate one and others as efficient ones. The R3 algorithm [6] is known for its accuracy. According to the R3 algorithm, the intersection point of the line-of-sight and the grid line indicates the terrain traversed by the line-of-sight and the elevation value of which is obtained by the interpolation of the two adjacent grid points. The accuracy of the R3 algorithm is secured by independent interpolation on each intersection point of each line-of-sight, resulting in time-consuming computation. In order to solve the efficiency problem of the R3 algorithm, a lot of algorithms have been proposed, including the R2 algorithm, the XDraw algorithm [6] and the reference plane algorithm [11]. By multiplexing and approximating, the time complexity of computation is reduced at the cost of some accuracy. Many improved methods are proposed based on these algorithms as well. To take the XDraw algorithm as an example, it takes only two points near the target point as the reference points to compute the viewshed of the viewpoint. Compared with the R3 algorithm, the XDraw algorithm greatly simplifies the computation process and improves the computational efficiency at the cost of certain accuracy. In order to improve the accuracy of the XDraw algorithm, Izraelevitz et al. traced back along the line-of-sight and included more points in computation [12]. Zhi et al. introduced the historical minimum visual elevation of each target point into computation as additional data [13]. Zhu et al. proposed the HiXDraw algorithm, using contribution points instead of reference points in XDraw as the basis for computing the visibility of the target points, thus avoiding the interference of irrelevant visible points (referred to as ‘chunk distortion’ in their work) on computational results [10]. To further improve the efficiency of the algorithms, many parallel computing methods have been proposed and applied to viewshed analysis as well, showing great potential [14]. Apart from these traditional algorithms or their enhanced versions, Tabik et al. [15] employ horizon calculation methods [16] in viewshed analysis. By dividing terrain into angle-based sectors, the viewshed result is turned into visible areas rather than visible points. This method opens a door for the following work [17,18] that focuses on efficiency.
This paper deeply studies another algorithm proposed by Wu et al. [19], based on a ‘proximity-direction-elevation’ (PDE) coordinate system and named the PDE spatial reference line (PDERL) algorithm. The PDERL algorithm stores some computational results in a data structure named the reference line, in order to present the exact elevation values of different positions with the greatest capability to block the LOS in all directions by accurate interpolation computation rather than an approximation to near grid point. Compared with the R3 algorithm, the efficiency of the PDERL algorithm is improved by data reuse. Compared with other algorithms, the accuracy of the PDERL algorithm is not compromised. In a word, the PDERL algorithm is able to take advantage of both and solve the problem of the inevitable trade-off between accuracy and efficiency. The original research proves the PDERL algorithm is perfectly accurate by theory and experimental results, in comparison with R3 as standard, and even more efficient than R3. However, the original research does not mention the cases where the observer is placed on grid points, and the original implementation does not produce very accurate results in practice. It is important to find out and correct the errors. In this paper, a checking algorithm for PDERL is proposed to find out problems that impair accuracy. The problems prove to be some implementation flaws and the float number accuracy problem. With the fundamental ideas of PDERL unchallenged, an improved implementation of the PDERL algorithm is proposed to solve or alleviate these problems, named as HiPDERL. In Section 2, the related work is introduced, namely the viewshed algorithms involved in this paper. In Section 3, the improvement work is introduced, including the process and problems of the PDERL algorithm, as well as the checking algorithm for PDERL and the improved PDERL implementation proposed in this paper. In Section 4, experiments are carried out to show the problems above through specific examples, then the accuracy and efficiency of the improved PDERL implementation are compared with other viewshed algorithms on various terrains. A summary is given in Section 5.

3. HiPDERL of Improvements on PDERL Algorithm

The original research proves the PDERL algorithm is perfectly accurate by theory and experimental results, in comparison with R3 as standard, and even more efficient than R3. However, the original research does not mention the cases where the observer is placed on grid points, and the original implementation does not produce very accurate results in practice. It is important to find out and correct the errors. Since the PDERL algorithm, as well as R3, investigates all intersection points made by the LOS and grid lines, a checking algorithm for PDERL is proposed to find out all the problems, substantially caused by the differences between R3 and PDERL in practical detail. All problems found are shown in this section. To deal with all these problems, a new implementation algorithm named HiPDERL is proposed in order to achieve better accuracy.
In another word, the checking algorithm is proposed to check the original PDERL and find what is different from R3 in practical detail, and HiPDERL as another implementation is proposed to minimize the differences, thus achieving better accuracy.

3.1. Checking Algorithm for PDERL

According to Equation (5), the ΔE value is obtained by subtracting the e values of the corresponding points on LR and LC, i.e., eR and eC, where eR is the maximum e value of all LOS-intersection points in the direction D, and eC is the e value of the target point when the corresponding point on LC is the target point. Since the horizontal coordinate D of the target point is exactly the direction of the LOS, the R3 algorithm could be transformed into a checking algorithm for PDERL based on the LOS. In the R3 algorithm, assuming the horizontal and vertical coordinate differences between the target point and the viewpoint as m and n, respectively, there are m − 1 horizontal-LOS intersections and n − 1 vertical-LOS intersections on the LOS. Let the elevation values of the target point and the viewpoint (with the height of the observer) on the DEM be hT and hS, respectively, and assume each horizontal/vertical-LOS intersection as the ith point closest to the viewpoint, with its elevation value on DEM as hi. Let the theoretical ΔE value of the target point be ΔEA when the PDERL algorithm is processing Region I and Region II, or ΔEB when it is processing Region III and Region IV, then the value of ΔEA and ΔEB is shown in Equations (9) and (10).
Δ E A = e C e R = h T h S m max ( h i h s i )       ,     i = 1 , 2 , , m 1                        
Δ E B = e C e R = h T h S n max ( h i h s i )       ,     i = 1 , 2 , , n 1                        
In theory, the value of ΔEA or ΔEB is supposed to be equivalent to those ΔE values figured out by the PDERL algorithm, so the checking algorithm is able to verify the computational result of the PDERL algorithm. Figure 6 shows how the checking algorithm checks the value of the value ΔEB above. The checking algorithm calculates the maximum e value of all the horizontal-LOS intersections, i.e., the value of eR of the coordinating point on the reference polyline LR in the D-E coordinate system. The checking algorithm also calculates the e value of the target point, i.e., the value of eL of the coordinating point on the current polyline LC in the D-E coordinate system, while the target point is considered as in Region IV rather than in Region I. Therefore, the value of ΔEB can be obtained by the difference between the value of eR and eC above, and then the corresponding ΔE value in the PDERL algorithm is checked.
Figure 6. The principle of the checking algorithm for PDERL based on the line-of-sight, where horizontal-LOS intersections refer to the intersections of the LOS and the horizontal grid line.
The differences in the computational results between the PDERL algorithm and the R3 algorithm are studied by checking the value of ΔE. With the support of the checking algorithm, the problems within the original PDERL implementation are found and shown in this paper. The checking algorithm itself is not for viewshed computation.

3.2. Existing Problems

3.2.1. Problem 1: Unprocessed Column

The first problem lies in an unexpected flaw. According to the design of the implementation of PDERL, the viewpoint can be placed off the grid points. However, when the viewpoint is placed on a grid point, the PDERL is not able to compute the visibility of the target points in the column where the viewpoint is located. The reasons are as follows. When the PDERL algorithm processes Region I and Region II, the visibility of the target points mentioned above is not computed, because they are not on the left or right side of the viewpoint. When the PDERL algorithm processes Region III and Region IV, the algorithm will only consider some of the visible target points as invisible. Therefore, there is no chance to compute the visibility of the target points that shares the same column with the viewpoint. The original implementation initializes the visibility of all target points as invisible before the PDERL algorithm begins, so the target points mentioned above are considered invisible once and for all. To solve this problem, independent visibility computation of these target points is added to the normal workflow of PDERL in this paper. The independent visibility computation is similar to R3, while its complexity is O(1) because the line composed of the target points allows data reuse. The solution to this problem is completely irrelevant to other problems since these target points are completely out of the PDERL algorithm.

3.2.2. Problem 2: Flaws within the Error Avoidance Mechanism

The second problem lies in that there are mistakes within the error avoidance mechanism in the PDERL implementation. This is another flaw as well. As shown in Figure 7, when LR and LC have an intersection within a subsection, and if the absolute value of ΔE is too small, the error avoidance mechanism within the original implementation considers the horizontal coordinate D of the intersection as equivalent to dA, as shown in Figure 7. However, in some cases, the mechanism mistakenly considers the horizontal coordinate D of the intersection as the same as dB, resulting in an error that may be transmitted via the fundamental data reuse of the PDERL algorithm. In order to solve this problem, this mechanism is remade in this paper.
Figure 7. The case to trigger the original error avoiding mechanism within PDERL.

3.2.3. Problem 3: Float Number Accuracy

With the checking algorithm, the implementation of PDERL proves to have some float number errors generated by machine operation, and these errors are transmitted through data reuse. As an example of the errors, (2.5 × 0.4–10 × 0.1) may not be calculated as absolute zero but as a small positive value. The original error-avoiding mechanism proved not effective against these errors.
Apart from the fundamental data reusing method within the PDERL algorithm that simplifies the visibility computation of subsequent target points by referring to the reference polyline, the PDERL algorithm applied data reusing methods to data structure and the calculation of ΔE value. For the data reusing method for data structure, the PDERL uses the linked list to store the reference polyline, whose nodes store the horizontal coordinate D value of the corresponding inflection point, and the slope value a between the inflection point itself and the previous one. Therefore, the e value of each inflection point needs to be calculated on a lot of float numbers by traversing the linked list. For the data reusing method for the calculation of ΔE value, it is shown in Equation (7) that the calculation of each ΔE value depends on the previously calculated ΔE value.
Although these methods manage to simplify the computation, reduce the number of variables used and achieve better efficiency, when an error occurs in calculating the e value or the ΔE value, for example, when some absolute zero values are calculated to be a non-zero number with very small absolute value, the data reuse may transmit the error in the two ways as follows:
(1) The vertical coordinate E of the inflection point on the reference line needs to be obtained by traversing the linked list. It is possible that an error caused by float number operation occurs while traversing the linked list in order to calculate the vertical coordinate E, and this error may become the basis for calculating subsequent e values. In this way, the error is passed on.
(2) The calculation of each ΔE value depends on the previous ΔE value. Therefore, any error that occurred within the calculation of a ΔE value results in the transmission of this error among all the following ΔE values.
The original error-avoiding mechanism may respond to the errors mentioned above, but is not designed to eliminate them, and therefore fails to prevent some errors from interfering with the computational result. This paper proposes an improved implementation of the PDERL algorithm, named HiPDERL to better solve these problems. Please view Section 4.2.2 for examples of the float number accuracy problems.

3.3. HiPDERL: An Improved PDERL Implementation Algorithm

HiPDERL, an improved implementation of the PDERL algorithm is proposed to solve the problems. HiPDERL simply applies the corrections mentioned in Section 3.2.1 to solve problem 1. It would be like processing the target points within the PDERL system and processing the unprocessed column independently afterwards. In addition, the improved implementation realizes a new error-avoiding mechanism to deal with the error within the calculation of ΔE, thus solving problem 2. If the absolute value of ΔE is smaller than a fixed small value, the ΔE value will be considered as an error of machine operation and set to exactly zero. The improved implementation will also check and eliminate the redundant inflection points on the reference line after the calculation on each current line LC is completed, so as to reduce the probability for errors to occur.
For problem 3, i.e., the float number accuracy problem, HiPDERL makes changes to the data reusing methods on data structure and the calculation of ΔE value, in order to minimize the generation or transmission of errors. The details within HiPDERL are introduced in this section. The fundamental ideas and procedures of the PDERL algorithm on data reuse remain unchanged. The terrain with the highest e value in each direction of the viewpoint is still stored by the reference polyline to simplify the visibility computation of each following target point.
The improved implementation changes the data structure of the reference polyline, using the nodes of the linked list to store the horizontal coordinate D and the vertical coordinate E of the corresponding point so that the e value of the corresponding point could be obtained without traversing the linked list, thus avoiding the possible error caused by float number operation in the traversal process. Due to these changes, if the intersection of the two polylines exists in any subsection, the vertical coordinate E of the intersection must be calculated as well, as one more value to be calculated in addition to the horizontal coordinate D of the intersection and the ΔE value at the end of the subsection. The improved implementation changes the way ΔE value is calculated as well, so the ΔE value no longer depends on the previous ΔE value, thus avoiding the transmission of relevant errors.
The details of the calculation are as follows. The improved implementation uses more data from the current polyline rather than the reference line for calculation, in order to minimize dependency on previous results that may cause accuracy problems.
The horizontal coordinate D of the intersection of the two polylines is still calculated according to Equation (8). However, since the linked list no longer stores the slope value a, this value needs to be calculated on relative inflection points of the reference polyline.
The vertical coordinate E of the intersection of the two polylines is calculated as follows: let the horizontal coordinate D of the intersection obtained according to Equation (8) be d′, and the vertical coordinate E be e′. Assume the horizontal coordinate D of the inflection point on the current polyline (i.e., the target point) closest to the intersection point and in the negative direction of axis D as dNC, and the vertical coordinate E as eNC. Assuming the slope value of the current polyline at the intersection is aiC, then the value of E’ is shown in Equation (11). The value of aiC is calculated with the DEM data.
e =   e N C + a i C   ( d d N C )
The ΔE value at the end of each segment is still obtained by the difference between eR and eC according to Equation (5). However, since the previous ΔE value is no longer depended on, the calculation of the ΔE value needs to be discussed under different conditions that the inflection point at the subsection is on the reference line or the current line.
When the inflection point of the subsection’s end is on the reference polyline, the value of eR can be directly obtained from the reference polyline, and the value of eC needs to be calculated. Let the horizontal coordinate D at the end of the subsection be di, and the ΔE value there be ΔEiR. Assume the horizontal coordinate D of the inflection point on the current polyline (i.e., the target point) closest to the end of the subsection and in the negative direction of axis D as dNC, and the vertical coordinate E as eNC. Assuming the slope value of the current polyline at the end of the subsection be aiC, then the value of ΔEiR is shown in Equation (12). The value of aiC is calculated with the DEM data.
Δ E i R = e C e R = ( e N C + a i C   ( d i d N C ) ) e R                                
When the inflection point of the subsection’s end is on the current polyline, the value of eC can be directly obtained from the current polyline, and the value of eR needs to be calculated. Let the horizontal coordinate D at the end of the subsection be di, and the ΔE value there be ΔEiC. Assume the horizontal coordinate D of the inflection point on the reference polyline closest to the end of the subsection and in the negative direction of axis D as dNR, and the vertical coordinate E as eNR. Assuming the slope value of the reference polyline at the end of the subsection be aiR, then the value of ΔEiC is shown in Equation (13). The value of aiR is calculated with the reference polyline data.
Δ E i C = e C e R = e C ( e N R + a i R ( d i d N R ) )                              
These are the new ways in which the values are calculated. In a word, to solve the float number accuracy problem caused by the traversal of the linked list, the improved implementation limits the generation and transmission of float number error by using the new data structure to represent the reference line and remaking a new error-avoiding mechanism. To solve the same problem caused by the calculation of the ΔE value, the improved implementation avoids using the previously calculated ΔE value in the calculation of the ΔE value. As mentioned in Section 3.2.3, the original implementation achieves better efficiency with some methods. The HiPDERL applies some other methods to ensure accuracy rather than the original efficient ones. Therefore, compared with the PDERL algorithm, the HiPDERL algorithm is expected to trade limited efficiency cost for better accuracy performance.

4. Experimental Results

4.1. Experimental Environments

Computational accuracy and efficiency experiments on different DEMs were conducted in this section.
There are two groups of DEMs used for the experiments. The first group is used for demonstration of problems within the PDERL, which involves one single 200 × 200 DEM obtained by sampling the original 2000 × 2000 DEM of Malaga, Spain at the horizontal and vertical interval of 10 points. The original DEM is adapted from the input DEM data provided by the implementation from Ref. [16], where the upper part is mountainous and the lower right part is a large zero-elevation area. The resolution of the original 2000 × 2000DEM is 10 m × 10 m, so the resolution of the 200 × 200 DEM used in this paper is 100 m × 100 m. Please notice that with such size and resolution, this DEM could hardly be meaningful for any practical application. It is used for a better demonstration of the problems only. The second group is used for accuracy and efficiency comparison experiments among various viewshed algorithms, which involves 3601 × 3601 DEMs of different terrains including mountains (N28E097), hills (N41E119) and plains (N34E114) from the ASTER GDEM. The resolution of these DEMs is 30 m × 30 m.
The accuracy experiment in this section (Section 4.2) took the R3 algorithm as the baseline algorithm. Problems 1, 2 (Section 4.2.1) and problem 3 (Section 4.2.2) of the PDERL algorithm are demonstrated on the first group of DEM, i.e., the 200 × 200 DEM of Malaga, Spain. The results by R3, PDERL, and HiPDERL are shown for comparison. The overall accuracy was compared among PDERL, HiPDERL, R3, XDraw, and HiXDraw on the second group of DEMs of different terrain (Section 4.2.3). XDraw and HiXDraw are used as references, in order to show the results of a traditional multiplexing algorithm and its enhanced version. The efficiency experiment in this section (Section 4.3) compared the time consumed by various algorithms in the accuracy comparison experiment in Section 4.2.3, respectively.
The hardware environment of this experiment is a computer with Windows 10 operating system, Intel (R) core (TM) i7-9750 h CPU at 2.60 GHz frequency, and 16GB of physical memory. These experiments were carried out in a single-threaded C++ environment, and the corresponding garbage collection mechanism was implemented for the linked list used by the PDERL algorithm. Considering that the HiPDERLand PDERL implementations realized the error-avoiding mechanism to eliminate float number errors, this experiment also configured similar mechanisms for R3, XDraw, and HiXDraw.

4.2. Experiments on Accuracy

4.2.1. Analysis of Implementation Flaws

The original error-avoiding mechanism has some implementation flaws, and cannot compute the visibility of the target points that share the same column with the viewpoint. An example that reflects the two problems at the same time is shown as follows. Figure 8 shows the case that R3 and PDERL were used to compute the viewshed of the viewpoint located at row 96, column 176 on the 200 × 200 DEM of Malaga, Spain mentioned above. Around the viewpoint are hills with escalating elevation from south to north, but the viewpoint is exactly surrounded by relatively higher grid points, so the viewshed on this point is not very large. In Figure 8, a red pixel represents a visible target point, and a blue pixel represents an invisible one. Figure 8a,b is the result of the R3 and HiPDERL algorithm, and Figure 8c,d is the result of the PDERL algorithm. The position of the viewpoint is marked with a white cross. Please notice that the problems could be on all DEMs, while the problems on this DEM may be better demonstrated.
Figure 8. The viewshed results of the viewpoint at row 96, column 176 on the DEM of Malaga, Spain by different algorithms. Observer is marked with a white cross. Red area is visible and blue area is invisible. (a) R3, while a totally same result by every cell is figured out using HiPDERL; (b) Part of (a), row 80–200, column 150–200; (c) HiPDERL; (d) Part of (c), row 80–200, column 150–200.
From the figure, it can be found that the PDERL algorithm cannot compute the viewshed of the target points in the column where the viewpoint is located, and they are initialized as invisible at the beginning. In addition, the result of the PDERL algorithm has more visible parts than the result of the R3 algorithm, which is due to the dislocation of the reference polyline caused by the original error avoiding mechanism and error accumulation caused by data reuse. The HiPDERL algorithm figured out the same viewshed result as the R3 algorithm after correcting the error-avoiding mechanism and adding independent computation of the target points in the column where the viewpoint is located. This case partly shows the consequence of the problems within the original implementation.

4.2.2. Analysis of Float Number Accuracy

The PDERL implementation suffers from the float number accuracy problem caused by machine operation errors. Figure 9 shows the case that R3 and PDERL were used to compute the viewshed of the viewpoint located at row 183, column 185 on the 200 × 200 DEM of Malaga, Spain. Around the viewpoint is a water area with an elevation of zero. In Figure 9, the red or blue pixel represents visible or invisible corresponding target points. Figure 9a,b is the result of the R3 and HiPDERL algorithm, and Figure 9c,d is the result of the PDERL algorithm. The position of the viewpoint is marked with a white cross. Please notice that the problems could be on all DEMs, while the problems on this DEM may be better demonstrated.
Figure 9. The viewshed results of the viewpoint at row 183, column 185 on the DEM of Malaga, Spain by different algorithms. Observer is marked with a white cross. Red area is visible and blue area is invisible. (a) R3, while a totally same result by every cell is figured out using HiPDERL; (b) Part of (a), row 140–200, column 100–200; (c) HiPDERL; (d) Part of (c), row 140–200, column 100–200.
In this example, the height of the observer at the viewpoint was set to zero. Figure 9 shows that the result of the PDERL algorithm is inconsistent with the result of the R3 algorithm in the lower right corner, which is similar to noise. It is mentioned above that the lower right part of the DEM is a zero-elevation area. The viewpoint, the target point, the noise points and the whole LOS are all located in this zero-elevation area. Since the height of the observer was zero as well, the R3 algorithm figured out that the elevation of the viewpoint and all the LOS-intersection points is zero, so the target point was determined to be invisible, as shown in Figure 10a. When the PDERL algorithm traversed the reference polyline, due to the error generated by float number calculation, the e value supposed to be zero was calculated as a negative number with a very small absolute value. Because the e value of the target point on the current polyline was zero, the ΔE value was positive and the target point was determined to be visible. At this time, the slope value a stored in the subsequent nodes on the reference polyline was zero, so the e value of the subsequent points of the reference polyline was calculated as this error again, as shown in Figure 10b. Although this noise problem can be neglected by changing the criteria of visibility determination in Equation (6), this is not recommended because in that case, some visible points would be considered invisible and be noise points again due to the same reason.
Figure 10. Reasons for the problem shown in Figure 9. (a) The DEM demonstration around the viewpoint at row 183, column 185; (b) The terrain profile of row 183. To calculate the visibility of the target point (marked with green in both figures), the PDERL algorithm must traverse almost the whole of row 183.
In general, the float number accuracy problem of the PDERL algorithm came from two aspects: the inherent error of the floating number operation and the error transmission caused by the implementation of the PDERL algorithm. The HiPDERL algorithm proposed in this paper is intended to solve the problems above. Compared with the PDERL, the result of the HiPDERL greatly reduced the amount of noise.

4.2.3. Comparison Experiment on Accuracy

This experiment takes 100 points as the horizontal and vertical interval on the 3601 × 3601 DEM of mountains, hills, and plains, thus obtaining 1225 points as viewpoints and computed their viewshed within a radius of 100 points for each viewpoint with various algorithms. Since the radius was taken as 100 points, the side length of each viewshed square is 201 points, which means for each viewpoint, the visibility of a total of 40, 400 target points within the viewshed square was computed. The number of all target points involved in this experiment is therefore very large, which is believed to eliminate possible contingencies. To use PDERL with problems unsolved as a comparison, the original version and the version free of problem 1 are selected. Problems 2 and 3 may seem separate, but they both involve small float absolute values and may interfere with each other, so they are regarded as one here. With the result of the R3 algorithm as baseline, this experiment compared the result of PDERL (original version and the version free of problem 1), HiPDERL, XDraw, and HiXDraw. Since the R3 algorithm was used as the baseline algorithm, the viewshed result by each algorithm inconsistent with the R3 algorithm of each viewpoint was regarded as errors. The experiment counted the total number of errors in the viewshed results of each viewpoint with different algorithms, and the results are shown in Table 1.
Table 1. Total error number and error rate on different DEMs with different algorithms (Total cell number: 49,490,000).
The experimental result shows that the original PDERL implementation is not more accurate than XDraw due to the problems mentioned above. The solution to problem 1 is helpful but not critical. For differences on different terrains, PDERL performed more accurately in the mountain area. In hill and plain areas, PDERL is not more accurate than the traditional XDraw algorithm. The HiPDERL algorithm shows the accuracy that a PDERL implementation should have. Experiments in the original research of PDERL claim that the PDERL algorithm is perfectly accurate. This may be the result of not placing the observer on the grid point. When the observer is on the grid point, many grid points will be in the same line, which is not critical for R3 because results on different points are computed separately, and few random float number errors will not be harmful. Things become very different for PDERL. Due to the fundamental idea of data reuse, errors (if any) will be certainly passed on and impair the accuracy of further computation. The case that the observer is on the grid point will make more coincidences that a target point is exactly invisible, which may be computed as visible by machine operation. So, it is important to adjust the error-avoiding mechanism and add new modifications to the original PDERL implementation.
Further detailed results of HiXDraw and PDERL (with problem 1 solved) are shown in Table 2 and Table 3. Compared with an enhanced and more accurate version of XDraw, the errors caused by the problems within the original PDERL may be better illustrated. For the cases where one algorithm makes over 100,000 errors on certain terrain, the original PDERL has more viewpoints than HiXDraw with an error rate below 0.1%. This indicates that the original PDERL is able to be accurate for more viewpoints. However, for the viewpoints with an error rate above 1%, those of the original PDERL (77 in hill area and 75 in plain area) are much more than that of HiXDraw (21 in mountain area and 19 in hill area).
Table 2. Total error number and viewpoint number with different error rate with PDERL (with problem 1 solved) (Total viewpoint number: 1225).
Table 3. Total error number and viewpoint number with different error rate with PDERL (with problem 1 solved) (Total viewpoint number: 1225).
Further investigation is carried out into the viewpoints with an error rate above 1%. There are cases where error points gather or scatter for both algorithms, including the cases with the most errors. The PDERL errors spread among lines from the first error point. The reasons are explained above. On the other hand, as an enhanced version of XDraw, HiXDraw suffers from accumulated errors positioned behind an error point, giving a radical distribution in the zenithal view image. Considering the statistics shown in the tables, HiPDERL provides a solution to the accuracy problems.

4.3. Comparison Experiment on Efficiency

In this experiment, the time consumed by each algorithm in the accuracy comparison experiment above was counted, i.e., the time consumed by each algorithm including the R3 algorithm to compute the viewshed of 1225 viewpoints within the range of 100 points on each DEM. The results are shown in Table 4.
Table 4. Time consumed on different DEMs with different algorithms (seconds).
The experimental result shows that XDraw achieved the highest computational efficiency, while the efficiency of PDERL and HiPDERL proved not significantly inferior to that of the XDraw family algorithms and was higher than that of the R3 algorithm. The efficiency of the HiPDERL was slightly lower than that of the PDERL. This is because the HiPDERL changes some data reusing methods in the PDERL are prone to generate or transmit errors, and also makes some computations more complex, thus increasing the computation time.
The experimental result also shows that the time consumed by the R3 algorithm in different terrain was not constant, while the time consumed by other algorithms was relatively constant. One possible explanation is that when the R3 algorithm is to determine whether the LOS is blocked and once the LOS is blocked, the algorithm may determine the target point as invisible and immediately interrupt the computation, so the actual time complexity may be lower than the theoretical value. It is usually difficult to predict whether and where the LOS is blocked because this varies among different maps. The steps of other algorithms are relatively simple, so the actual workload on different terrain was relatively fixed as well.

5. Conclusions

This paper pointed out that when the observer is not on grid points, the original PDERL algorithm does not produce very accurate results in practice. After the analysis of the PDERL algorithm, a checking algorithm for the PDERL algorithm was proposed in order to find out the problems. With all problems found, a new implementation algorithm named HiPDERL, based on the fundamental ideas of PDERL, was proposed to solve the problems. Experiments showed that HiPDERL achieved better accuracy than the original PDERL implementation at the cost of a little efficiency. The future work is to apply the HiPDERL algorithm to the computation of total viewshed. There exist very efficient total viewshed algorithms, but no baseline algorithm is used for comparison on accuracy because the traditional accurate algorithms R3 is less efficient for total viewshed analysis and the cost in time will be immeasurable. HiPDERL greatly reduces the cost in time and maintains the computational accuracy in comparison with R3. Therefore, HiPDERL could be a potential baseline algorithm to assess the accuracy of existing and upcoming total viewshed algorithms.

Author Contributions

Conceptualization, Haozhe Cheng and Wanfeng Dou; Data curation, Haozhe Cheng; Formal analysis, Haozhe Cheng and Wanfeng Dou; Funding acquisition, Wanfeng Dou; Methodology, Haozhe Cheng; Software, Haozhe Cheng; Writing—original draft, Haozhe Cheng; Writing—review & editing, Haozhe Cheng and Wanfeng Dou. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the National Natural Science Foundation of China (No. 41930102, No. 41771411).

Data Availability Statement

All data are available online. Respective origins of these data are stated in this article.

Acknowledgments

The authors thank the reviewers for their patience and suggestions. They helped improve the article. The authors also thank Yuan Pang for suggestions on English grammar.

Conflicts of Interest

No potential conflict of interest was reported by the authors.

References

  1. Dou, W.; Li, Y.; Wang, Y. A fine-granularity scheduling algorithm for parallel XDraw viewshed analysis. Earth Sci. Inform. 2018, 11, 433–447. [Google Scholar] [CrossRef]
  2. Bongers, J.; Arkush, E.; Harrower, M. Landscapes of death: GIS-based analyses of chullpas in the western Lake Titicaca basin. J. Archaeol. Sci. 2012, 39, 1687–1693. [Google Scholar] [CrossRef]
  3. Li, J.; Zheng, C.; Hu, X. An Effective Method for Complete Visual Coverage Path Planning. In Proceedings of the 2010 Third International Joint Conference on Computational Science and Optimization (CSO), Huangshan, China, 28–31 May 2010; Volume 1, pp. 497–500. [Google Scholar]
  4. Cervilla, A.; Tabik, S.; Romero, L. Siting multiple observers for maximum coverage: An accurate approach. Procedia Comput Sci. 2015, 51, 356–365. [Google Scholar] [CrossRef][Green Version]
  5. Qiang, Y.; Shen, S.; Chen, Q. Visibility analysis of oceanic blue space using digital elevation models. Landsc. Urban Plan. 2019, 181, 92–102. [Google Scholar] [CrossRef]
  6. Franklin, W.R.; Ray, C.K.; Mehta, S. Geometric Algorithms for Siting of Air Defense Missile Batteries; Research Project Report, Contract Number DAAL03-86-D-0001, Delivery Order number 2756; Battelle Columbus Division: Columbus, OH, USA, 1994. [Google Scholar]
  7. Yaagoubi, R.; Yarmani, M.E.; Kamel, A.; Khemiri, W. HybVOR: A voronoi-based 3D GIS approach for camera surveillance network placement. ISPRS Int. J. Geo-Inf. 2015, 4, 754–782. [Google Scholar] [CrossRef]
  8. Gonçalves, A.B.; Almeida, J.; Rua, H. Assessment of the Permeability of Historical Defensive Systems: The Case of the Lines of Torres Vedras. Int. J. Hist. Archaeol. 2016, 20, 229–248. [Google Scholar] [CrossRef]
  9. Gillings, M. Mapping invisibility: GIS approaches to the analysis of hiding and seclusion. J. Archaeol. Sci. 2015, 62, 1–14. [Google Scholar] [CrossRef]
  10. Zhu, G.; Li, J.; Wu, J.; Ma, M.; Wang, L.; Jing, N. HiXDraw: An Improved XDraw Algorithm Free of Chunk Distortion. ISPRS Int. J. Geo-Inf. 2019, 8, 153. [Google Scholar] [CrossRef]
  11. Wang, J.; Robinson, G.J.; White, K. Generating viewsheds without using sightlines. Photogramm. Eng. Remote Sens. 2000, 66, 87–90. [Google Scholar]
  12. Izraelevitz, D. A fast algorithm for approximate viewshed computation. Photogramm. Eng. Remote Sens. 2003, 69, 767–774. [Google Scholar] [CrossRef]
  13. Zhi, Y.; Wu, L.; Sui, Z.; Cai, H. An improved algorithm for computing viewshed based on reference planes. In Proceedings of the IEEE 2011 19th International Conference on Geoinformatics, Shanghai, China, 24–26 June 2011; pp. 1–5. [Google Scholar]
  14. Dou, W.; Li, Y. A fault-tolerant computing method for Xdraw parallel algorithm. J. Supercomput. 2018, 74, 2776–2800. [Google Scholar] [CrossRef]
  15. Tabik, S.; Zapata, E.L.; Romero, L.F. Simultaneous computation of total viewshed on large high resolution grids. Int. J. Geogr. Inf. Sci. 2013, 27, 804–814. [Google Scholar] [CrossRef]
  16. Stewart, A.J. Fast horizon computation at all points of a terrain with visibility and shading applications. Vis. Comput. Graph. IEEE Trans. 1998, 4, 82–93. [Google Scholar] [CrossRef][Green Version]
  17. Tabik, S.; Cervilla, A.R.; Zapata, E.; Romero, L.F. Efficient data structure and highly scalable algorithm for total-viewshed computation. IEEE J. Sel. Top. Appl. Earth Obs. Remote Sens. 2015, 8, 304–310. [Google Scholar] [CrossRef]
  18. Sanchez-Fernandez, A.J.; Romero, L.F.; Bandera, G.; Tabik, S. A data relocation approach for terrain surface analysis on multi-GPU systems: A case study on the total viewshed problem. Int. J. Geogr. Inf. Sci. 2020, 35, 1500–1520. [Google Scholar] [CrossRef]
  19. Wu, C.; Guan, L.; Xia, Q.; Chen, G.; Shen, B. PDERL: An accurate and fast algorithm with a novel perspective on solving the old viewshed analysis problem. Earth Sci. Inform. 2021, 14, 619–632. [Google Scholar] [CrossRef]
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.