File Exchange

image thumbnail

Flow Accumulation (upslope area)

version (107 KB) by Wolfgang Schwanghart
Flow accumulation algorithm that routes through flats


Updated 10 Feb 2015

View Version History

View License

*** Note that this file is outdated. Please find TopoToolbox, a Matlab suite of functions for topographic analysis at . wflowacc will be removed from the File Exchange in the future. ****
How much water flows where? Use this algorithm to calculate the upslope area of each cell in a digital elevation model.

Algorithm specifications:
- multiple flow direction
- single flow direction
- routes across flats
- calculates deterministic, randomized and random flow
- allows you to specify a weighting exponent that governs the relation flow direction - slope
- handles edge effects

Cite As

Wolfgang Schwanghart (2021). Flow Accumulation (upslope area) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

sudarshan ray p

Sir, it is my research project

Wolfgang Schwanghart

To all: TopoToolbox is now available here:

TopoToolbox can handle larger grids than wflowacc can and has many more utilities related to digital elevation model analysis.

Wolfgang Schwanghart

Hi Liam,

thanks for your feedback. The code is it stands right now is a multiple flow direction algorithm, and yes, it can be very "dissipative". There is a way to avoid this behavior by element-wise exponentiate the flow direction matrix (M), so that steep gradients gain a larger weight than smaller ones.

I'll work on an update of this version and include it as an additional option.

Thanks a lot again for the feedback.


Liam Reinhardt

A good user friendly piece of code. Unfortunately it does not seem to generate single thread 'rivers' 1 cell wide. Instead cells of high accumulation are often adjacent to each other (i.e. perpendicular to the primary flow direction) producing messy flow paths.

Wolfgang Schwanghart

Hi Jorge,

you are right. The algorithm is quite memory demanding and grids exceeding 600x600 cells may cause problems. I am currently working on an improved version that allows for huge grids. Please be a bit patient...

Best regards,

Jorge Santos Santos

Does not work for large rivers

Wolfgang Schwanghart

I did not include a fill sinks option as it requires the image processing toolbox. If you have this toolbox use

demfs = imfill(dem,'holes')

Best regards,

Salvatore Manfreda

Good, but do not have a fill sinks option that would be very useful.

looks good

looks good

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!