1

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...

1 Answer 1

0

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
1
  • your hint solved my problem! i was confused, because using the gui without setting a region works fine. but it seems like the region is needed to use processing. how ever - thanks!
    – niels...
    Feb 25, 2014 at 14:04

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.