Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whitebox Geospatial Analysis Tools

I wrote a number of ArcGIS VBA automations in grad school; however, they're fully dependent on the ESRI SpatialAnalyst extension, which is not only closed-source but expensive to the point of deterrence.

Since VBA is deprecated and since some researchers at the U still use my VBA tools, I thought it would be fun to rewrite them in .Net. But now, with more experience, I further realize it would be more appropriate for academic use if those utilities consumed open algorithms.

With this in mind, I'm considering Whitebox GAT as a potential stand-in for the SpatialAnalyst hydrology tools, and I'm curious if there are any success stories or time-saving "gotchas" related to ArcGIS/Whitebox integration.

I anticipate several folks will want to counter-suggest implementing Saga, GRASS, R, et cetera. If this is your position, please describe why pursuing a Whitebox integration would be unwise. For example, does it only support a few input formats, has it poor handling of large (1-2 GB+) files, is it slower than my hockey skating.. You get the idea. :)


I did some playing around with the Whitebox UI, and with the help of their tutorials, it wasn't difficult to pre-process a 30-meter DEM I had laying around. Next, after lining-up the hydro rasters, I created a pour point and rendered its watershed. This was enough to get a feel for the Whitebox user experience.

Whitebox is extendible and/or consumable using .Net or Python. Having accomplished some basics in the Whitebox UI, I thought I'd chain together the typical DEM pre-processing tasks with a simple .Net automation (no ArcMap just yet). DEM pre-processing usually means the following:

  1. set no data value (Whitebox needs this, but Arc never did)
  2. fill sinks
  3. create a flow direction raster
  4. create a flow accumulation raster

I put together the following Windows Form "application" (aka WhiteboxDaisyChain). It takes a system directory containing an ArcGIS Grid (.FLT) and performs the tasks noted above. If you want to try this, you'll need to download the compiled binaries, unzip, then copy all the .dll files from ..\WhiteboxGAT_1_0_7\Plugins into your project -- I put everything in ..\WhiteboxDaisyChain\Whitebox. However, this example only needs the four DLLs mentioned at the top of the code sample.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

// 1) Create a new Windows Form
// 2) Put all these in a Whitebox folder in the C# project root.
// 3) Add project references to the following and create using statements:

using Interfaces;       // requires Add Reference: Interfaces.dll
using ImportExport;     // requires Add Reference: ImportExport.dll
using ConversionTools;  // requires Add Reference: ConversionTools.dll
using flow;             // requires Add Reference: flow.dll

namespace WhiteboxDaisyChain
    // 4) Prepare to implement the IHost interface.
    // 5) Right-click IHost, select "Implement interface.."
    public partial class UI : Form, IHost

        // 6) Add a BackgroundWorker object.
        private BackgroundWorker worker;

        public UI()

            // 7) Instantiate the worker and set "WorkerReportsProgress".
            worker = new BackgroundWorker();
            worker.WorkerReportsProgress = true;

        // 8) Use some event to set things in motion.. i.e. Button click.
        private void button1_Click(object sender, EventArgs e)
            progressLabel.Text = "Running..";

            // This is the path containing my ArcGrid .FLT.
            // All processing will unfold to this directory.
            string path = "C:\\xData\\TutorialData\\DemWhitebox\\";

            string[] fltArgs = new string[1];
            fltArgs[0] = path + "greene30.flt";                 // in: Arc floating point grid

            // creates a raster in Whitebox data model
            ImportArcGrid importAG = new ImportArcGrid();
            importAG.Initialize(this as IHost);
            importAG.Execute(fltArgs, worker);                  // out:  path + "greene30.dep"

            // set the nodata value on the DEM
            string[] noDataArgs = new string[2];
            noDataArgs[0] = path + "greene30.dep";              // in: my raw DEM
            noDataArgs[1] = "-9999";                            // mine used -9999 as nodata value

            SetNoData setNoData = new SetNoData();
            setNoData.Initialize(this as IHost);
            setNoData.Execute(noDataArgs, worker);              // out:  path + "greene30.dep"

            // fill sinks in the DEM
            string[] fillSinksArgs = new string[4];
            fillSinksArgs[0] = path + "greene30.dep";           // in: my DEM with NoData Fixed
            fillSinksArgs[1] = path + "greene30_fill.dep";      // out: my DEM filled
            fillSinksArgs[2] = "50";                            // the dialog default
            fillSinksArgs[3] = "0.01";                          // the dialog default

            FillDepsBySize fillSinks = new FillDepsBySize();
            fillSinks.Initialize(this as IHost);
            fillSinks.Execute(fillSinksArgs, worker);

            // create a flow direction raster
            string[] flowDirArgs = new string[2];
            flowDirArgs[0] = path + "greene30_fill.dep";        // in: my Filled DEM
            flowDirArgs[1] = path + "greene30_dir.dep";         // out: flow direction raster

            FlowPointerD8 flowDirD8 = new FlowPointerD8();
            flowDirD8.Initialize(this as IHost);
            flowDirD8.Execute(flowDirArgs, worker);

            // create a flow accumulation raster
            string[] flowAccArgs = new string[4];
            flowAccArgs[0] = path + "greene30_dir.dep";         // in: my Flow Direction raster
            flowAccArgs[1] = path + "greene30_acc.dep";         // out: flow accumulation raster
            flowAccArgs[2] = "Specific catchment area (SCA)";   // a Whitebox dialog input
            flowAccArgs[3] = "false";                           // a Whitebox dialog input

            FlowAccumD8 flowAccD8 = new FlowAccumD8();
            flowAccD8.Initialize(this as IHost);
            flowAccD8.Execute(flowAccArgs, worker);

            progressLabel.Text = "";
            progressLabel.Text = "OLLEY-OLLEY-OXEN-FREE!";

        /* IHost Implementation Methods Below Here */

        public string ApplicationDirectory
            get { throw new NotImplementedException(); }

        public void ProgressBarLabel(string label)
            this.progressLabel.Text = "";
            this.progressLabel.Text = label;                    // This is the only one I used.

        public string RecentDirectory
                throw new NotImplementedException();
                throw new NotImplementedException();

        public bool RunInSynchronousMode
                throw new NotImplementedException();
                throw new NotImplementedException();

        public void RunPlugin(string PluginClassName)
            throw new NotImplementedException();

        public void SetParameters(string[] ParameterArray)
            throw new NotImplementedException();

        public void ShowFeedback(string strFeedback, string Caption = "GAT Message")
            throw new NotImplementedException();

So far I'm digging this, but I don't yet have a real success story or any show-stoppers to describe.. My next goal will be interactively submitting pour points from ArcMap. Basically, I want to click the map ..get the watershed.

share|improve this question

closed as too broad by PolyGeo Jan 5 at 3:45

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

I just wanted to point out the the latest versions of Whitebox allow you to digitize a shapefile pour point on-screen to input to the watershed tool. It works quite well. JL – user21951 Sep 17 '13 at 18:35
@JohnLindsay, hey there, I recognize you as the Guelph professor who created Whitebox. When I started this thread back in Jan 2012, Whitebox was written in .Net, but now it's in Java I understand. I've considered deleting this thread as irrelevant, since the .Net stuff isn't maintained, but if the old release is still available, even unmaintained, it's still valuable. I had thought about creating a mobile app for floating enthusiasts that consumed Whitebox in .Net WebServices, but I've since tabled that idea. Have I overlooked an "archives" among the downloads? – elrobis Sep 26 '13 at 15:15

If you want to consider other applications outside of Spatial Analyst, you might consider looking into the the SEXTANTE library. While I have not personally used it, if you watch this video clip, you can see that they demonstrate ways to work with rasters.

Why might you consider this toolset? They already have built the "SEXTANTE for ArcGIS extension" (free), which allows users to consume SEXTANTE tools in ArcMap.

share|improve this answer
That's a nice tip, I'll look into it. – elrobis Jan 12 '12 at 17:25
Note, SEXTANTE for ArcGIS doesn't exist anymore. See this question. – Fezter Jan 16 '14 at 3:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.