1

1.I want to implement this python code

wd = pluginHost.getWorkingDirectory(C:\xampp\htdocs\learn\doit) 
flowPointer = wd + "d8flowpointer.dep" 
outputFile = wd + "manjflowaccscript.dep" 
outputType = "specific catchment area (sca)"
logTransformOutput = "false" args = [flowPointer, outputFile,
outputType,      logTransformOutput]
pluginHost.runPlugin("FlowAccumD8", args, False)

How to pass my working directory to whitebox scripting tool?When i try above code

It's giving this error message SyntaxError: no viable alternative at input ':' in at line number 1 at column number 37

1 Answer 1

1

I think that your problem is with this line:

wd = pluginHost.getWorkingDirectory(C:\xampp\htdocs\learn\doit) 

The 'getWorkingDirectory' method returns a String, it doesn't take one as a parameter. I think what you want instead is this:

wd = "C:\xampp\htdocs\learn\doit"
pluginHost.setWorkingDirectory(wd) 

However, note that Whitebox will update the working directory as you work with spatial data. This means that if you've recently opened a file for display in that directory, it'll already be set as the working directory.

The 'pluginHost' object (quite literally the Whitebox GUI) implements the Communicator and WhiteboxPluginHost interfaces and the details of the various methods belonging to these can be found here:

https://code.google.com/p/whitebox-geospatial-analysis-tools/source/browse/trunk/WhiteboxAPI/src/whitebox/interfaces/Communicator.java

https://code.google.com/p/whitebox-geospatial-analysis-tools/source/browse/trunk/WhiteboxAPI/src/whitebox/interfaces/WhiteboxPluginHost.java

You may also want to see these tutorial on workflow automation and scripting in Whitebox:

http://whiteboxgeospatial.wordpress.com/2014/02/20/workflow-automation-in-whitebox-gat/

http://whiteboxgeospatial.wordpress.com/2014/09/14/workflow-automation-part-2/

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.