5

I wanted to test the r.viewshed module from grass via the Toolbox in QGis. But no File is generated. This is the log output:

Algorithm r.viewshed - Computes the viewshed of a point on an elevation raster map. starting...
g.proj -c proj4="+proj=longlat +datum=WGS84 +no_defs"
r.external input="/home/matt/Desktop/slopes/N34E069.hgt" band=1 output=tmp14931314968715 --overwrite -o
g.region n=35.0004166667 s=33.9995833333 e=70.0004166667 w=68.9995833333 res=0.000833333333333
r.viewshed input="tmp14931314968715" coordinates=69.6949645541,34.744452777 observer_elevation="2.00" target_elevation="0.0" max_distance="5000" refraction_coeff="0.14286" memory="500" -b output=output1415b59dffed4d07a82eb7ffa7b96a65 --overwrite
g.region raster=output1415b59dffed4d07a82eb7ffa7b96a65
r.out.gdal --overwrite -c createopt="TFW=YES,COMPRESS=LZW" input=output1415b59dffed4d07a82eb7ffa7b96a65 output="/home/matt/.qgis2/processing/outputs/viewshed_test.tif"
Starting GRASS GIS... 
Executing ... 
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default 
Projection information updated 
WARNING: Over-riding projection check 
Reading band 1 of 1... 
r.external complete. Link to raster map created. 
Computing events... 
Aborted 
ERROR: Raster map not found 
ERROR: Raster map or group not found 
Execution of finished. 
Cleaning up temporary files... 
Starting GRASS GIS... 
Executing ... 
ERROR: Raster map not found 
ERROR: Raster map or group not found 
Execution of finished. 
Cleaning up temporary files... 
Converting outputs
Loading resulting layers

The following layers were not correctly generated.
Intervisibility
You can check the log messages to find more information about the execution of the algorithm

It says that the raster map was not found, however, the file exists at the specified location. I am using QGis 2.18.6

What am I doing wrong?

EDIT: This is the Dialogbox for the r.viewshed:

enter image description here

I've also tried with the python console, but there I do not get any log messages (no output file either):

import processing
from PyQt4.QtCore import QFileInfo

rasterPath="/home/matt/Desktop/slopes/N34E069.hgt"
fileInfo=QFileInfo(rasterPath)
baseName=fileInfo.baseName()
rLayer = QgsRasterLayer(fileInfo.filePath(), baseName)

# Define extent
extent=rLayer.extent()
xmin=extent.xMinimum()
xmax=extent.xMaximum()
ymin=extent.yMinimum()
ymax=extent.yMaximum()

extStr="%f,%f,%f,%f" % (xmin, xmax, ymin, ymax)

# define viewpoint and outputDir
coordStr = '%d,%d' % (34.841101,69.679670)
outputViewshed = "/home/matt/Desktop/slopes/viewshed_test.tif"  
processing.runalg("grass7:r.viewshed", rLayer, coordStr, '0', '0', '800', 0.14286, 500, False, False, False, False, extStr, 0, outputViewshed) 
7
  • I am using the Dialog box for this, however, before, I've tried with Python code. I've added the screenshot of the dialog and the python code.
    – M F
    Commented Apr 25, 2017 at 15:13
  • I never used a raster file having a Geographic Reference System... Maybe is the error related to that? Did you try using another raster file?
    – mgri
    Commented Apr 25, 2017 at 15:15
  • No, I did not try that yet. Hmm, However, I do not know where to get other file formats of the raster file ...
    – M F
    Commented Apr 25, 2017 at 15:42
  • @MF Reproject the raster file and try again
    – underdark
    Commented Apr 25, 2017 at 18:53
  • I've figured something out. I've used a dem .tif file which I've downloaded from gdex.cr.usgs.gov/gdex; Now, It processes but an error occurs on the terminal saying ERROR 4: /home/matt/Desktop/slopes/viewshed_test.tif": No such file or directory. This is the path to my output file. If I leave the output file path out (using a temp output file), the same error occurs. It seems like a permission problem to me but I am not sure.
    – M F
    Commented Apr 26, 2017 at 8:22

1 Answer 1

0

For me the workaround for this issue was setting the region extent and the cellsize (instead of leaving them blank)

EDIT: Setting the extent to be too large made the issue reappear

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.