I'm making a QGIS plugin that uses grass:r.viewshed
to analyze the area of terrain visible from different points. However, I've noticed, that when using a viewpoint where the elevation between the viewpoint and terrain is greater than the maximum distance parameter, points are still highlighted on the terrain. Surely these should be marked as invisible as they are outside of the view range?
This is my code for the viewshed:
try:
params = {'input' : rasterName,
'coordinates': coordStr,
'observer_elevation': 60000 + depthAtPoint,
'target_elevation': 3,
'max_distance': 50000,
'memory': viewshedMemory,
'output': pointPath,
'-b':True}
result = processing.run("grass7:r.viewshed",
params,
feedback=feedback)
except QgsProcessingException as e: #Handle and print any processing exceptions
print(e)
rasterName
contains the name of the raster. In this example I'm using the raster SR_50M_alaska_nad.tif from QGIS's sample data library. (https://download.qgis.org/downloads/data/)
coordStr
are the coordinates of the viewpoint.
depthAtPoint
is the depth/elevation value sampled from the raster at the coordinates of the viewpoint. I've added 60000 to it in the parameters, which should mean that the terrain is completely out of view from the viewpoint (since the maximum distance is only 50000). But in my results, it still seems to be highlighted, which is the problem.
As you can see below, the terrain is still highlighted (red) by the viewshed. Surely it shouldn't be, as the distance from terrain to viewpoint is greater than the max distance?