A fast, simple and versatile algorithm to fill the depressions of digital elevation models
Contents:
---------
This is the original algorithm of Planchon & Darboux 2001, A fast, simple and versatile algorithm to fill the depressions of digital elevation models. Catena 46:159-176.
Algorithm:
----------
The original paper can be downloaded here: ftp://130.237.63.22/Common/UllaM/For_Imran/%5B2001%5D%20planchon%20-%20a%20fast,%20simple%20and%20versatile%20algorithm%20to%20fill%20the%20depressions%20of%20digital%20elevation%20models.pdf
Usage (example):
----------------
Z = magic(5) ;
W = nosink(Z) ; % => transforms depressions into flat areas.
epsilon = 0.1 ;
W = nosink(Z, epsilon) ; % => transform depressions into gentle slopes. (a step of at least epsilon is requred between any cell and its lowest neighbor)
Installation:
-------------
1/ copy the file nosink.cpp in your current Matlab working directory
2/ enter this command at the console:
> mex nosink.cpp
3/ test with this command:
Z = nosink(magic(5)) ;
the result will be the magic(5) matrix itself since there is no depression there.
Note on Matlab data types:
--------------------------
The following datatypes are allowed:
int8, int16, int32, int64, float, double.
Footprint:
---------
Time complexity is almost linear (see the paper to learn in which worst case it is not linear)
No memory (except the 'kitchenware') is used beside the 2 matrixes (input and output)
Tests:
-----
Very little tests were done at the moment.
-> Matlab 7.12.0, Ubuntu 12.04, gcc 4.6.3
Please report any bug
Cite As
Olivier Planchon (2025). A fast, simple and versatile algorithm to fill the depressions of digital elevation models (https://se.mathworks.com/matlabcentral/fileexchange/38603-a-fast-simple-and-versatile-algorithm-to-fill-the-depressions-of-digital-elevation-models), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Mathematics and Optimization > Mapping Toolbox > Data Analysis >
- Radar > Mapping Toolbox > Data Analysis >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
