We try to calculate catchments with the r.water.outlet function from python console. To do so we use the following code:

import processing
rlayer = QgsRasterLayer("/my/path/DrainageDirection.tif", "DrainageDirection")
processing.runalg("grass:r.water.outlet", rlayer , 2621378.611131 ,1262320.888212, "2589700, 2640500, 1242200, 1270000", 73, "/my/path/zzz.tif")

The result in the zzz.tif file is only one pixel with no value. This result differs when running the r.water.outlet is called from the GRASS Tools GUI.

So, three questions:

1) Do we handle the input raster (rlayer) correct?
2) Do we handle the output raster correct?
3) Would it be possible to read a GRASS Mapset raster directly from python console?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.