File Exchange

image thumbnail

Upslope area functions

version (292 KB) by Steve Eddins
Functions for computing and visualizing upslope area, influence map, dependence map


Updated 01 Sep 2016

View Version History

View License

A collection of functions for calculating the upslope area and related measurements for a digital elevation model (DEM).
Based on the method of Tarboton.

See also the upslope area postings on my image processing blog, March-August 2007,

Requires Image Processing Toolbox.

Functions include dem_flow, dependence_map, facet_flow, fill_sinks, flow_matrix, influence_map, pixel_flow, postprocess_plateaus, upslope_area, vis_dem_flow, and vis_map.

Includes a sample DEM data set.

Cite As

Steve Eddins (2021). Upslope area functions (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

Steve Eddins

dEns - It did not require a password when I downloaded it just now. Do you get the same thing when you download other File Exchange submissions?


a password is requested to open the .zip file. Is there a specific way to obtain it?

Steve Eddins

Andres - See influence_map.

Thanks for your answer Steve.

Sorry, but I have another question: is it possible to calculate the dowstream path for each pixel of the catchment (again I would need the coordinates or location of the pixels that are included in each of these downstream paths)?


Steve Eddins

Andres - Yes. Look at the function dependence_map.

Hi Steve,

Thank you for the algorithm.

I am trying to get the upslope areas for each pixel of the catchment, not just the value of the area, but the coordinates or location of the pixels that are included in each of these upslope areas. Is it possible with your algorithm?

Thank you in advance.

Steve Eddins

Bard, I am not doing any active algorithm development in this area right now, and I have no plans to enhance this submission. You might want to take a look at Wolfgang Schwanghart's TopoToolbox:

Bard R.

Great algorithm, how would modify it to include flow length as well?

How do you combine this script with flow data?
If the flow was the same for each pixel I could simply multiple the upslope area by a constant. Since this is not the case I need to find a way of inputting my flow data as it calculates the up slope area.

Can anyone enlighten me,

Felix Hebeler

After implementing Tarbotons Dinf algorithm for calculating flow directions I finally stumpled upon your toolbox, which is a lot faster. Thanks for the implementation, maybe if you add a keyword 'flow direction' it could save some other users some work ;-)

Wolfgang Schwanghart

Hi Steve,

areas of interest to geographers often are catchments which commonly have irregular shape. Beyond the watersheds there is often a lack of data. Hence, these values outside the catchment are NaNs. While NaNs inside the catchment may be interpolated the NaNs outside can merely be extrapolated.

Hence, I tried following. I replaced the NaNs in the DEM by -Inf. That works except that it produces an erroneous flow direction on the watershed pixels.

Best regards,

Steve Eddins

Hi Wolfgang,

Do you have opinion about should be done with NaNs?

Thanks, Steve

Wolfgang Schwanghart

Hi Steve,

great contribution! Users of older Matlab versions (R14) need to replace the function hypot(s1,s2) by
s = sqrt(abs(s1).^2 + abs(s2).^2)

One critique: The functions don't handle NaNs.

Best regards, Wolfgang

MATLAB Release Compatibility
Created with R2007a
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!