gdal_viewshed when positionning the observer at the summit of a cliff (steep mountain)
Expected behavior and actual behavior.
Using gdal_viewshed, we notice an anomaly when positionning the observer at the summit of a cliff (steep mountain).
Steps to reproduce the problem.
N40W106.HGT is a patched DTM in SRTM format with all elevation set to 0.0m but one to 255m, localized at Latitude 40.255833 and Longitude -105.615833. We create a Viewshed from this point: gdal_viewshed -oz 2. -tz 0. -md 0.1 -ox -105.615833 -oy 40.255833 N40W106.HGT viewShed.tif
At this position (corresponding to the summit of the DTM), the expected result is a square rectangle (in WGS) because:
- the observer (2m height) is placed on the center on the area at an elevation of 255m
- the area at 255m is a square (square of about 30 m side corresponding to the DTM pixel size) -> so the ground (0m elevation) near the observer must not be visible -> the observer can see the ground only if the distance is greater than DY=257*15/2 = 1927.5m
Result of gdal_viewshed execution: Below the observer, there is (Cf. viewShed.tif) a "butterfly" effect : only 2 quart of sqare are invisible, the rest is visible.
On a real DTM, the result of gdal_viewshed has the same default if the observer is on the summit of a cliff: Cf. ViewShed on a Cliff (Actual behaviour).jpg.
Operating system
Windows 10
GDAL version and provenance
3.7.0 viewShed.zip
CC @szekerest