, Volume 19, Issue 4, pp 671–692 | Cite as

Efficiently computing the drainage network on massive terrains using external memory flooding process

  • Thiago L. Gomes
  • Salles V. G. Magalhães
  • Marcus V. A. AndradeEmail author
  • W. Randolph Franklin
  • Guilherme C. Pena


We present EMFlow, a very efficient algorithm and its implementation, to compute the drainage network (i.e. the flow direction and flow accumulation) on huge terrains stored in external memory. Its utility lies in processing the large volume of high resolution terrestrial data newly available, which internal memory algorithms cannot handle efficiently. The flow direction is computed using an adaptation of our previous method RWFlood that uses a flooding process to quickly remove internal depressions or basins. Flooding, proceeding inward from the outside of the terrain, works oppositely to the common method of computing downhill flow from the peaks. To reduce the number of I/O operations, EMFlow adopts a new strategy to subdivide the terrain into islands that are processed separately. The terrain cells are grouped into blocks that are stored in a special data structure managed as a cache memory. EMFlow’s execution time was compared against the two most recent and most efficient published methods: TerraFlow and r.watershed.seg. It was, on average, 25 and 110 times faster than TerraFlow and r.watershed.seg respectively. Also, EMFlow could process larger datasets. Processing a 50000 × 50000 terrain on a machine with 2GB of internal memory took about 4500 seconds, compared to 87000 seconds for TerraFlow while r.watershed.seg failed on terrains larger than 15000 ×15000. On very small, say1000 ×1000 terrains, EMFlow takes under a second, compared to 6 and 20 seconds in r.watershed.seg and TerraFlow respectively. So EMFlow could be a component of a future interactive system where a user could modify terrain and immediately see the new hydrography.


Terrain modeling Hydrology External memory GIS 



This research was partially supported by CAPES (Science without Borders), FAPEMIG, CNPq and NSF grant IIS-1117277.


  1. 1.
    Aggarwal A, Vitter JS (1988) The input/output complexity of sorting and related problems. Commun ACM 31(9):1116–1127CrossRefGoogle Scholar
  2. 2.
    Anderson-Tarver C, Gleason M, Buttenfield B, Stanislawski L (2012) Automated centerline delineation to enrich the national hydrography dataset. In: Xiao N, Kwan M P, Goodchild M, Shekhar S (eds) Geographic Information Science, Lecture Notes in Computer Science, vol 7478. Springer Berlin Heidelberg, pp 15–28Google Scholar
  3. 3.
    Arge L, Chase JS, Halpin P, Toma L, Vitter JS, Urban D, Wickremesinghe R (2003) Efficient flow computation on massive grid terrain datasets. Geoinformatica 7(4):283–313. doi: 10.1023/A:1025526421410 CrossRefGoogle Scholar
  4. 4.
    Collet Y (2012) Extremely fast compression algorithm, (Accessed on June-2014)
  5. 5.
    Danner A, Agarwal PK, Yi K, Arge L (2007) Terrastream: From elevation data to watershed hierarchies. In: Proc. ACM Sympos. on Advances in Geographic Information Systems, pp 212–219Google Scholar
  6. 6.
    Haverkort H, Janssen J (2012) Simple I/O-efficient flow accumulation on grid terrains. CoRR abs/1211.1857,
  7. 7.
    Jenson S, Domingue J (1988) Extracting topographic structure from digital elevation data for geographic information system analysis. Photogramm Eng Remote Sens 54(11):1593–1600Google Scholar
  8. 8.
    Magalhães SVG, Andrade MVA, Franklin WR, Pena GC (2012) A new method for computing the drainage network based on raising the level of an ocean surrounding the terrainGoogle Scholar
  9. 9.
    Metz M, Mitasova H, Harmon RS (2011) Efficient extraction of drainage networks from massive, radar-based elevation models with least cost path search. Hydrol Earth Syst Sci 15(2):667–678. CrossRefGoogle Scholar
  10. 10.
    Moore ID, Grayson RB, Ladson AR (1991) Digital terrain modelling: A review of hydrological, geomorphological, and biological applications. Hydrol Proc 5(1):3–30. doi: 10.1002/hyp.3360050103 CrossRefGoogle Scholar
  11. 11.
    O’callaghan JF, Mark DM (1984) The extraction of drainage networks from digital elevation data. Comput Vision Graph Image Proc 28(3):323–344CrossRefGoogle Scholar
  12. 12.
    Planchon O, Darboux F (2002) A fast, simple and versatile algorithm to fill the depressions of digital elevation models. Catena 46:159–176CrossRefGoogle Scholar
  13. 13.
    Silveira JA, Magalhães SVG, Andrade MVA, Conceição VS (2013) A library to support the development of applications that process huge matrices in external memory. In: Proceedings of 15th International Conference on Enterprise Information Systems (ICEIS), Angers, France, pp 153–160Google Scholar
  14. 14.
    Soille P, Gratin C (1994) An efficient algorithm for drainage network extraction on DEMs. J Vis Commu Image Represent 5(2):181–189CrossRefGoogle Scholar
  15. 15.
    Stanislawski LV, Buttenfield BP (2011) Hydrographic generalization tailored to dry mountainous regions. Cartogra Geograph Inf Syst 38(2):117–125CrossRefGoogle Scholar
  16. 16.
    Stuetzle C, Franklin WR, Cutler B, Muckell J, Andrade MVA, Stookey J, Inanc M, Xie Z (2008) Hydrology preservation of simplified terrain representations. In: 16th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (ACM GIS 2008), Irvine CA, USAGoogle Scholar
  17. 17.
    Tarboton D (1997) A new method for the determination of flow directions and contributing areas in grid digital elevation models. Water Resour Res 33(2):309–319CrossRefGoogle Scholar
  18. 18.
    Vitter JS (2008) Algorithms and data structures for external memory. Now Publishers Inc., HanoverGoogle Scholar

Copyright information

© Springer Science+Business Media New York 2015

Authors and Affiliations

  • Thiago L. Gomes
    • 1
  • Salles V. G. Magalhães
    • 1
  • Marcus V. A. Andrade
    • 1
    Email author
  • W. Randolph Franklin
    • 2
  • Guilherme C. Pena
    • 1
  1. 1.Department of InformaticsFederal University of ViçosaViçosaBrazil
  2. 2.ECSE Department, Rensselaer Polytechnic InstituteTroyUSA

Personalised recommendations