Chapter 8 of The Nature of Code, Fractals, is about recursion and self-similar branching: a form whose parts repeat the structure of the whole at every scale. River networks are one of the clearest natural cases, the same fork-into-smaller-forks pattern from trunk to twig.
Rather than invent the fractal with recursive drawing code, I pull waterway=river and waterway=stream reaches from OpenStreetMap (Overpass API) for a bounding box around the Colorado-Green confluence near Canyonlands, Utah, and draw those polylines directly. Channel class is an ordered stand-in for trunk vs twig, encoded as a single blue ramp: rivers dark and thick, streams light and thin. The fractal is in the mapped drainage basin, the geometry Chapter 8 usually builds by hand.
Drainage networks are statistically self-similar: a sub-basin tends to reproduce the branching statistics of the whole. In the hydrology literature that is often summarized with Strahler stream order and Horton’s ratios \(R_B = N_i / N_{i+1}\) and \(R_L = \bar{L}_{i+1} / \bar{L}_i\), plus a box-counting dimension near 2 for a filled basin. This sketch does not compute Strahler numbers; it draws OSM’s waterway classes directly (river vs stream) as a two-level stand-in for trunk and twig. The self-similarity is in the mapped geometry Chapter 8 would otherwise invent with recursion.
Data source: OpenStreetMap (Overpass API)
Endpoint:https://overpass-api.de/api/interpreter(waterways in bbox38.08,-110.02,38.42,-109.58)
Access: Public, no key. Loaded from an hourly server-side refresh when possible, with a bundled snapshot fallback, and a live browser fetch only when the API allows CORS. Data window: Colorado-Green confluence, Canyonlands UT (OSM waterways; pulled Aug 6, 2026 UTC)
Colorado-Green confluence, Canyonlands UT. All 280 waterway reaches are listed below.