Richard Cooke

Drainage Tools

Practical drainage-related QGIS tools and Excel spreadsheets

QGIS plugins, processing scripts, Excel workbooks and how-to guides that make subsurface drainage design faster and more repeatable.

Tools

QGIS plugins for drainage and terrain work. Each card links to the plugin's folder on GitHub, with its README, install steps and source code, and to its zip file for installing in QGIS. Once installed, the drainage tools are grouped under Vector → Tile Drainage and Raster → Tile Drainage in QGIS.

Plugin · v1.2.0

Surface Interpolation

Grids scattered point data into a raster using minimum curvature (with optional tension) or natural neighbor interpolation.

Plugin · v1.3.0

Line Angle

Click a line segment, or two points, to get its angle in degrees. Includes a Processing tool that writes every segment's angle to a field.

Plugin · v1.1.0

Random Point Selection

Randomly selects a set number or percentage of points from a layer, with an optional seed for repeatable results.

Plugin · v0.6.0

Illini Main Tile Locator

Finds the best tile main from a clicked outlet, a DEM and a field boundary, for laterals parallel or perpendicular to the contours. Scores dozens of candidate mains by how much of the field their laterals can drain to, buries them with Illini Drainage Tools routine J, and returns the chosen main and four runners-up, labelled by rank. Can also add submains until the field is covered. Maximum lateral length defaults to the capacity of a 4-inch tile on a 0.1% slope. A curved main can be smoothed or turned into straight sections of a minimum length, and the chosen main is also written in straight sections as a layer that opens in Tile Profile.

Lays out, buries and sizes a tile drainage network in one run, from a DEM, field boundary, outlet and spacing, using the burying and pipe-sizing schemes of Illini Drainage Tools routines J and K. Laterals can be straight (following the terrain or running north-south, east-west or diagonally), follow the contours, or follow the contours in the 8 compass directions (8-point). The network stores tile and ground elevations at every vertex for the Tile Profile plugin. An optional Tile elevation raster highlights where the tile is shallower than the minimum cover or deeper than the maximum depth. No tile bends more sharply than 120 degrees, and the tool remembers its settings between runs. Tile can be buried with Routine J, as shallow as the minimum cover and grade allow, with the fewest grade breaks, or at least cost (grade breaks balanced against distance from the target depth), with an optional limit on the change of grade at a break and an option to hold the outlet at a fixed invert. Pipes are sized with one drainage coefficient (0.375 inch/day by default), ready for the Tile Size Calculator. A second tool imports LANDRAIN network files as Illini networks.

Lays out a tile network for subirrigation and controlled drainage in one run: splits the field into water management zones by elevation (or from drawn zone polygons), lays laterals within each zone, places a control structure with its board elevation for each zone, and buries and sizes the network with the Illini Subsurface Drain Layout engine. A Level within zones burying method keeps the tile of each zone near level and below the zone's board, so all of it can take water in from the structure. Reports the share of each zone the managed water table controls and the share of tile below the board.

Plugin · v0.8.0

Tile Profile

Select a lateral or main and a docked panel draws its profile: the ground, the target and absolute tile-depth lines, and the tile with its grade breaks, junctions and section slopes. Flat and reverse sections are flagged. Check network maps where the tile is too shallow or too deep and lists the profiles to check. The whole network, single points, or the slope above a point can be adjusted, and break points can be added to a line so part of a section takes a different slope; changes are previewed and applied to the layer, with BURY_CHECK rechecked.

Plugin · v0.2.1

Tile Size Calculator

Resizes the pipes of an Illini Subsurface Drain Layout network in a docked panel. The drainage coefficient can be one value for every line, one per Strahler order, or set pipe by pipe by clicking pipes on the map, and the pipe type can be set for the whole network or section by section along a main. The new length of each pipe size shows at once, and the sizes are written to the layer with Routine K of the Illini Drainage Tools. A Bill of materials tab lists pipe by size, tees, wyes, reducers, elbows, end caps, outlet pipe, rodent guard, structures and installation, prices them from an editable price table, totals them by NRCS practice for EQIP, and makes a ready-to-print quote layout or a custom layout from a template. Water control structures can be counted from a Control structures layer on the map.

Designs a complete tile drainage system in one run, from drawn tile lines to buried depths and pipe sizes, combining Illini Drainage Tools routines E to K. Tile can be buried with Routine J, as shallow as the minimum cover allows, with the fewest grade breaks, or at least cost, optionally from a fixed outlet invert. The output is the same drainage network as Illini Subsurface Drain Layout's, ready for Tile Profile and the Tile Size Calculator, so it can also be used to re-bury a modified surface layout from Illini Subsurface Drain Layout.

Plugin · v2.0.2

Tile Drainage Layout

Guides hand-digitizing a tile layout: draws a setback line half the tile spacing inside each field boundary, optionally fills it with parallel laterals at a set angle (or parallel to the longest edge), and connects them to a supplied main, with a junctions layer of tees and crosses.

Plugin · v0.1.0

Water Management Zones

Splits a tile-drained field into water management zones for controlled drainage and subirrigation, and places a control structure for each zone, with its board elevation, latitude and longitude and the share of the zone the managed water table controls. Works from elevation bands alone, or from a drainage network, including several separate systems with their own outlets. Also maps each zone's lowest point and where the tile crosses the field boundary, with surface elevation and tile depth there, and compares zone intervals.

Plugin · v1.1.0

Raster Extremes

Finds the cells with the maximum and minimum values of a raster band and gives their X and Y coordinates, with an optional point layer of the results.

Plugin · v2.0.1

DRAINMOD Weather Files

Click a point to download daily rainfall and max/min temperature from Daymet and write ready-to-use DRAINMOD .RAI and .TEM weather files in one step.

Writes ready-to-use DRAINMOD .RAI, .TEM and .PET weather files for future climate scenarios, from downscaled CMIP6 projections (NASA NEX-GDDP-CMIP6 or LOCA2) for a point or a layer of points, across several models and SSP scenarios at once.

Click a point to build a DRAINMOD soil input (.soi) file from SSURGO. Combines horizons into at most five layers and computes the soil water characteristic with the van Genuchten equation, using Rosetta or Carsel & Parrish texture-class parameters or the Rosetta 3 web service.

Plugin · v0.4.5

LiDAR Field DEM

Builds a bare-earth DEM for a field from Illinois Height Modernization (ISGS) or USGS 3DEP LiDAR, downloading only the tiles it needs. Lists the collection years available, allows tracing the field on the map, extends the DEM beyond the field for outlets, optionally fills sinks (Wang & Liu), colors the DEM with a hillshade, handles whole watersheds, and runs in the background.

Plugin · v0.4.0

Depressions and Laylines

For subsurface drainage design: maps the depressions in a field deeper than a set depth (filled minus unfilled DEM, default 0.75 ft) with their area, depth and storage, and the laylines (flow channels) with stream order and contributing area. Adds contours from the filled DEM and colors the DEM green to brown over a hillshade.

Plugin · v1.3.0

Boundary Contours

Contour lines from a DEM, like the QGIS Contour tool, but only inside a field boundary (or its selected polygons), clipped exactly to it. Every Nth line is flagged as an index contour and drawn thicker with elevation labels. Can contour a sink-filled DEM, with pits filled flat to their spill level, and smooth the DEM, the lines or both. Remembers its settings for each project.

Plugin · v0.1.0

Field Run-on

Maps the run-on areas of a field, the land outside it whose surface water flows in, from the field boundary and a DEM of its watershed. Splits the run-on by concentrated inlet and sheet flow, or into connected areas, with vector (smoothed) and raster maps of their acres, the inlet points, and a flag where an area runs off the edge of the DEM.

Plugin · v1.12.0

SSURGO drainage soil map

Gets the Web Soil Survey soil map for a field boundary shapefile, or a field traced on the map, and saves it as a shapefile labeled with the soil names, with acres, drainage class and hydrologic group for each soil, Hooghoudt drain spacing for a given drain depth and drainage coefficient, subirrigation spacing from the inverse Hooghoudt equation, and an optional field outline.

The worldwide, metric companion to SSURGO drainage soil map. For a field anywhere in the world, downloads ISRIC SoilGrids 2.0 (250 m) soil properties, groups them into soil zones by texture above and below the drains, estimates Ksat with Rosetta 3, and gives each zone a Hooghoudt drain spacing and an inverse Hooghoudt subirrigation spacing in metres.

Companion to the SSURGO and SoilGrids drainage soil maps. Pick a soil map they made, enter a new drain depth, drainage coefficient, mid-drain water table, impermeable layer depth or subirrigation water levels, and get a copy with recalculated Hooghoudt drain spacings and inverse Hooghoudt subirrigation spacings, their range from low and high Ksat, and drain footage and cost for each soil, plus a field summary with design spacings for the whole field. US customary or metric units. Works offline; run it once per scenario.

Plugin · v0.3.0

StreamStats Delineator

Click near a stream to delineate the watershed upstream of it with USGS StreamStats. Snaps to the nearest stream, adds the basin with its drainage area, the NHDPlus streams inside it, and sub-basins split at stream confluences with downstream routing links for hydrologic models.

Plugin · v2.5.0

Drainage Outlet

Traces the natural downhill path from a drainage system outlet point, or from a field boundary, to the nearest stream inside its StreamStats watershed. For a field, finds where most of its runoff leaves the boundary. Fills depressions in the DEM, follows the steepest-descent flow path, and reports the path length, drop, slope and the stream it reaches. Uses NHD flowlines or channels derived from the DEM. Works in feet or metres, can download and keep a USGS 3DEP DEM, and runs in the background.

Plugin · v0.1.0

Tile Outlet Submergence

How much a rising water level in the outlet ditch reduces the flow from a tile drainage system, for a network from Illini Subsurface Drain Layout and the DEM. Steps the hydraulic grade line up the network from the ditch level with Manning's equation and reduces the drainage rate wherever water stands in the drains, with Hooghoudt's equation, iterated to a steady state. Writes a rating curve of outflow and affected area against the ditch level (also as a CSV file), maps of the drainage rate and of the HGL rise in every pipe at each level, and an HTML report. A Ditch level explorer panel, also in the report, steps the map up and down through the ditch levels with the outflow, a flap-gate warning, the main's profile and the values at a clicked point.

Plugin · v0.1.0

Crop History

Crop history and rotation of fields from the USDA NASS Cropland Data Layer, downloaded year by year from CropScape: the main crop each year, the crop sequence, the rotation (corn-soybean, continuous corn, with small grain or hay…), years in each crop, a rotation map and the latest CDL. For the background step of a drainage design and the crop inputs of ROI and DRAINMOD studies.

Plugin · v1.4.0

Layout from Template

Creates a print layout of the current map from a .qpt template, or a ready-made layout with title, legend, scale bar, north arrow and frame. Fits the map to the selected layer and picks landscape or portrait to match it, with optional PDF or image export.

Plugin · v0.1.3

Design Reports

Writes the Illinois Drainage System Design and Subirrigation Design reports (Word) from their templates, filled from the design layers: soil map, watershed, depressions and run-on areas, LiDAR contours with laylines, system maps with every pipe's size, length and slope, irrigated area, subirrigation zones and an overlay map for each control structure.

Superseded · v0.8.0

Subsurface Drainage Layout

No longer developed: use Illini Subsurface Drain Layout, which lays out the network the same way and adds burying, pipe sizing and more. Set its Burying method to Minimum cover for this plugin's burying. Kept here for existing projects.

Spreadsheets

Excel workbooks with macros for drainage design. Each card links to the workbook's folder on GitHub, with its README and its macro code as text, and to a zip of the workbook. Windows blocks macros in downloaded files: before opening, right-click the zip → Properties → tick Unblock → OK, then extract it and click Enable Content in Excel.

Excel workbook · v1.4

DRAINMOD Calibration

Calibrates a DRAINMOD project to measured daily drain flow, water table depth or both by maximizing the Kling-Gupta efficiency, with Dynamically Dimensioned Search, several runs side by side and a final polish. A sensitivity analysis (Morris elementary effects) first ranks the parameters, from soil layer Ksat, surface storage and seepage to drain depth, spacing and depth to the impermeable layer. Writes the calibrated project next to the original, which is never changed.

Excel workbook · v1

DRAINMOD Drainage Design

Runs a DRAINMOD project for every combination of drain depth, drain spacing and weather set, current and future, several runs side by side, and charts relative yield (overall, excess water, drought, planting delay) against drain spacing for each crop, to pick a design that holds up in a changing climate. Comes with DDESIGN, an example Drummer soil project with Champaign weather for 1980–2010 and 2040–2099; add DRAINMOD (free from NC State) to run it.

Excel workbook · v1

DRAINMOD Path Fixer

Points a moved or copied DRAINMOD project at where it is now: finds the old and new places, rewrites the paths in the .prj, .gen and input files, and flags missing files, crop paths too long for DRAINMOD and mismatched crop counts. Checks before it changes anything, keeps .bak copies and can undo.

Drainage design tables and calculators converted from the University of Illinois Agricultural Engineering Visual Basic programs, one per sheet: minimum ditch radii, maximum drain lengths, minimum grades, wheel loads on drains, maximum trench depths for tubing and tile, drainage pumping plants (capacity, power and storage), and Manning's equation for open channels of six shapes.

Drain spacing for Illinois soils: pick one of 237 soils and its drainage group, conductivity, drainable porosity and profile depth fill in, then get the spacing from the steady-state Hooghoudt (or Kirkham) equation, the transient van Schilfgaarde equation, or the NRCS subirrigation equation, for a 4-inch drain. Also opens the soil's official series description and the Illinois drainage group recommendations.

Excel workbook · v1.2

Main Telescoping Worksheet

Sizes each section of a telescoping main from the flow it carries: laterals, upstream area, attached pipes, direct inflow and surface inlets. Manning's equation for single-wall, dual-wall, clay and concrete pipe, rounded up to the nominal size.

Excel workbook · v1

Pipe Sizing

Manning's equation for drain pipe flowing full, with optional sediment in the pipe: from any two of tile size, slope, flow rate, velocity and drained area, gives the drained area, the smallest standard tile size, the slope, the flow rate or the velocity. Single-wall, dual-wall, clay and concrete pipe or your own n, and a chart of pipe capacity against slope for the chosen drainage coefficient.

Excel workbook · v1

Tile Slopes

Sets the tile elevation along a main or lateral from the ground profile: the tile follows the target depth band within minimum and maximum slopes and absolute depth limits, with an optional constant-slope section, and a chart of surface, limits and tile.

About

This site provides a set of free, open‑source QGIS tools and Excel spreadsheets for agricultural drainage analysis and design.

All tools are maintained in the QGIS_Tools GitHub repository, where users can access the source code, contribute, and follow updates.

Contact

Found a bug or have an idea for a tool? Open an issue on GitHub.

© 2026 Richard Cooke Hosted on GitHub Pages · Report an issue