The Watershed
Where Rain Becomes Runoff
Every raindrop belongs to exactly one watershed. Orbit a 3-D basin, drop virtual rain on a topographic map, and watch D8 routing decide where every drop ends up β no Python required.
Your path through this module
1 Β· What is a watershed?
A watershed (also called a catchment or drainage basin) is the area of land that drains to a single outlet β a stream gauge, a lake, or a river mouth. Every point on land belongs to exactly one watershed.
The outer boundary is the divide: a ridge line along which any raindrop on one side eventually flows one way, and a drop on the other side flows the opposite way. The divide follows the highest topographic points surrounding the catchment.
A continuous ridge line forming the outer boundary. Defined entirely by topography β extractable from a DEM without any surveying.
The single point where all water leaving the watershed is measured. Change the outlet location β change the watershed boundary.
Cyan dashed = watershed divide Β· Blue = stream network Β· Circle = measurement outlet
2 Β· Orbit a synthetic watershed in 3-D
A procedurally generated horseshoe catchment β ridges on three sides, a single outlet at the south. Drag to orbit Β· scroll to zoom Β· right-drag to pan.
Colour: β green-teal = valleys Β· β blue = mid-slope Β· β white = ridges. Cyan lines trace the stream network converging to the outlet at bottom-centre.
3 Β· How topography decides where water goes β the D8 algorithm
A computer extracts the watershed by applying one rule to every cell in a DEM: water flows to whichever of the 8 neighbouring cells is lowest. This is the D8 algorithm (eight-direction flow).
- Look at 8 neighbours (N, NE, E, SE, S, SW, W, NW).
- Find the steepest drop β the neighbour with the greatest elevation difference.
- Follow that path downhill until the edge of the DEM or a sink.
4 Β· Drop virtual rain β trace the D8 flow path
Click any cell on the elevation map to drop a virtual raindrop. The D8 algorithm traces the path to the outlet (cyan circle, south edge). Click near the outlet to reveal the full contributing area.
The highlighted path is the flow path. All cells routing through a given point form the contributing area for that outlet.
5 Β· Checkpoint
Three questions β pass all three to mark this module complete and unlock DEM β TWI.
1 Β· The watershed divide is defined byβ¦
2 Β· In the D8 algorithm, a cell's flow direction points towardβ¦
3 Β· Moving the stream gauge 10 km upstream wouldβ¦
Sources & Further Reading
- Dingman, S. L. (2015). Physical Hydrology, 3rd ed. Waveland Press. β Watershed definition and delineation concepts, Chapter 3.
- Jenson, S. K. & Domingue, J. O. (1988). Extracting topographic structure from digital elevation data for GIS analysis. Photogrammetric Engineering & Remote Sensing, 54(11), 1593β1600. β Original D8 algorithm.
- O'Callaghan, J. F. & Mark, D. M. (1984). The extraction of drainage networks from digital elevation data. Computer Vision, Graphics, and Image Processing, 28(3), 323β344. β Flow accumulation and channel extraction.
- Author
- Mohammad Galib Β· Purdue University
- License
- CC-BY-4.0 β free to reuse with attribution
- Module ID
watershed-runoffΒ· v0.1.1- Course
- Introduction to Hydrology Β·
intro-hydro-2026 - Data
- All terrain is synthetic (procedurally generated); no real DEM used
- Dependencies
- three.js r128 (lazy CDN, 3-D only); no kernel required