Thursday 7 April 2016

qgis - no output file with grass:r.los



i'm using qgis 2.0 and i want to calculate a viewshed using r.los from grass tool box. after typing in the python console and a few seconds, i don't get an error message, but there is no file.


the r.los gui works fine.


processing.runalg('grass:r.los',"Elevation",'642229,5598076',None,75,5000,False,None,None,'C:\\r_LOS')
{'output': 'C:\\r_LOS.tif'}

someone got an idea?!


thanks - niels...



Answer



No file = Some error did happen. When errors are not raised to the ui check the log file.


I think what you need is to add the bound of the data to the r.los function like:



processing.runalg('grass:r.los',"Elevation",'642229,5598076',None,75,5000,False,'700000.0,710000.0,6200000.0,6220000.0',None,'C:\\r_LOS')

The data bound '700000.0,710000.0,6200000.0,6220000.0' is for some of UTM zone 32, looks like your down in Germany somewhere, so add you own bound definition.


Look at the processing log (in Windows: C:\Users\YourName\.qgis2\processing\processing.log). For a quick and formatted access to the log set the toolbox window to "Keep dialog open after running an algorithm", in the Processing > Options and configuration > General dialog.


enter image description here


If you first run the r.los from a Processing dialog instead of the Python Console, you can see the processing.runalg command generated by Processing.


enter image description here


Use this to double check you Python code function parameters from the log. Running the r.los first manually will also from the log, give you the bound of your dataset.


enter image description here


The processing.log file will show you the complete runalg command with values right after the ALGORITHM|Tue Feb 25 2014 text. Where as the above log dialog only shows the bound in GRASS sub function syntax like:



r.external input="D:/temp/2/DTM.vrt" band=1 output=tmp1393320497225 --overwrite -o -r
g.region n=6220000.0 s=6200000.0 e=710000.0 w=700000.0 res=50

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...