1

I am trying to run r.water.outlet by PyQGIS but getting grass folder not configured error

I have QGIS 2.18 installed and Grass is not installed on windows 10 and I am able to use r.water.outlet from Processing>Toolbox>r.water.outlet but getting error for using it by PyQGIS below code

from qgis.core import * 
from PyQt4.QtGui import *
import processing
registry = QgsMapLayerRegistry.instance()
watershedLayer =registry.mapLayersByName('Gondala_AET-PET')[0]
xmin = watershedLayer.extent().xMinimum()
xmax = watershedLayer.extent().xMaximum()
ymin = watershedLayer.extent().yMinimum()
ymax = watershedLayer.extent().yMaximum()
processing.runalg('grass:r.water.outlet', 'Drainage direction' , 695991.202933 , 2180877.920948 ,"%f,%f,%f,%f"% (xmin, xmax, ymin, ymax),
 0.0,'b') # 'Drainage direction' is layer name in layer panel

Below is window pop up after running this script.

enter image description here

asked Sep 19, 2017 at 3:57

1 Answer 1

1

According to , the qgis doc

the path to the GRASS folder has to be defined, but only if you are running Windows. Additionally, a shell interpreter (usually msys.exe, which can be found in most GRASS for Windows distributions) has to be defined and its path set up as well.

To do this, go to the "processing" tab> and "Options"> "Providers"> GRASS etc..enter image description here .

This is a print screen on macOS, so you should set your path correctly according to your windows install.

answered Sep 19, 2017 at 7:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.