Terrain cell size and small-feature refusals
Every water, earthwork, terrain, and lidar result in TileMapper shows the terrain cell size it was worked at, read from the terrain's own record (or from the saved result's provenance record when it was saved on an earlier terrain). When a record stores no cell size, the app states cell size not recorded and refuses nothing on that ground.
Thresholds (judgment, starting points)
Both coarse-terrain refusal thresholds live as named constants in one place, packages/surface/src/resolution.ts, and are imported by @tilemapper/earthwork and the web app:
| Constant | Value | Basis |
|---|---|---|
MIN_FEATURE_WIDTH_CELLS |
3 cells |
Judgment: a starting point, neither cited nor yet measured; proposed in docs/engineering/plan-v3-signoffs.md, Question 4, still unanswered |
MIN_BASIN_CELLS |
9 cells |
Judgment: a starting point, neither cited nor yet measured; proposed in docs/engineering/plan-v3-signoffs.md, Question 4, still unanswered |
A refusal always states needs finer terrain, gives the two numbers that explain why (the feature's width or the basin's cell count, and the terrain's cell size), and states what to do: Rebuild the terrain at a finer cell size under Elevation data.
A refusal withholds the numeric result, map shading, report figures, and exported cell/levee outputs for that feature, while still letting the user draw and save the feature so it can be evaluated after rebuilding terrain at a finer cell size.
Complete inventory of results
| Result | Where worked | Grid read | Cell size shown now | Refusal rule applied |
|---|---|---|---|---|
| Water level over ground & flooded volume | packages/surface/src/flood.ts, surface-water-panel.tsx |
dem_original |
Basis line below water-level answer (Worked on X m cells / Cell size not recorded) |
Does not apply (whole-terrain stage flood) |
| Raindrop path | packages/surface/src/flow.ts, surface-water-layer.tsx |
flow_dir, fill_depth, dem_original |
Basis line on Raindrop map card | Does not apply (1-cell-wide flow-path trace) |
| Clicked watershed | packages/surface/src/flow.ts, surface-water-layer.tsx |
flow_dir, outside_entry, dem_original |
Basis line on Watershed map card (from recorded provenance) | Refused in delineateWatershed if < 9 cells, land entering from past the edge counted (checkWatershedResolution) |
| Saved watersheds list & GeoJSON / KML | surface-water-panel.tsx, lib/terrain/surface-water.ts |
Saved polygon + provenance.cellSizeM |
Saved cell size inline on each list row (X m cells / cell size not recorded), GeoJSON cell_size_m & cell_size, KML README Cell size: |
Refused before saving if delineated watershed < 9 cells |
| After a big rain comparison & low spots | packages/surface/src/runoff.ts, surface-water-panel.tsx |
dem_original, flow_dir, fill_depth, outside_entry |
Basis line in rain comparison panel; refused-spot count warning | Listed low spot refused if < 9 cells (checkLowSpotResolution) |
| Rain side-by-side swipe card | surface-water-panel.tsx, surface-water-layer.tsx |
Same grids as rain comparison | Basis line + refused-spot notice inside swipe card | Same as rain comparison (refused spots unshaded) |
| Measured volume (pile / pit / lagoon) | packages/surface/src/volume.ts, surface-water-layer.tsx |
dem_original |
Basis line on Volume map card | Refused in measureVolume if < 9 cells or min width < 3 cells (checkMeasuredVolumeResolution) |
| Terrain low spots overlay list | services/gis-worker/.../hydrology.py, terrain-layers.tsx |
dem_original, flow_dir, fill_depth |
Basis sentence in Low spots summary (Worked on X m cells) |
Listed spot row refused if < 9 cells (checkLowSpotResolution) |
| Spot elevations card & CSV | spot-elevations-layer.tsx, lib/terrain/spot-elevations.ts |
dem_original |
Saved provenance.cellSizeM tag on each spot row; cell_size_m column in CSV |
Does not apply (single-point elevation sample) |
| Elevation profile | lib/terrain/profile.ts, profile-panel.tsx |
dem_original |
Basis line in profile chart footer | Does not apply (1D profile sample line) |
| DEM GeoTIFF & Contour downloads | lib/terrain/download-readme.ts, lib/terrain/contour-export.ts |
dem_original |
README Cell size:, GeoJSON cell_size_m & cell_size, DXF header Cell size:, KML & Shapefile README Cell size: |
Does not apply (whole-terrain surface/contour export) |
| Ditch (list, card, profile, station table) | packages/earthwork/src/ditch.ts, surface-earthwork-panel.tsx, earthwork-list.ts |
dem_original |
Earthwork card header basis line (+ saved cell size if different); list shows Needs finer terrain |
Refused if design top width < 3 cells (checkDitchResolution) |
Ditch drainage area (Drains to ditch) |
packages/earthwork/src/ditch.ts, surface-earthwork-panel.tsx |
flow_dir |
Same earthwork card header basis line | Refused if watershed < 9 cells (checkDitchDrainageResolution) |
| Outlet on designed ditch invert proposal | packages/earthwork/src/ditch.ts, outlet-survey.tsx |
dem_original (via analyzeDitch) |
Basis line inside On designed ditch card |
Withheld (no invert offered) when ditch is refused |
| Culvert (capacity & flow breach) | packages/earthwork/src/culvert.ts, surface-earthwork-panel.tsx |
None for HDS-5 capacity; flow_dir for breach |
Earthwork card header basis line (saved or active terrain cell size) | Does not apply (checkCulvertResolution always ok; see below) |
| Leveling area / Cut & fill (list, card, map) | packages/earthwork/src/grading.ts, uncertainty.ts, surface-earthwork-panel.tsx |
dem_original |
Earthwork card header basis line | Refused if < 9 cells or min width < 3 cells (checkGradingPlaneResolution) |
| Cut & fill HTML/PDF report & grid CSV | packages/earthwork/src/export.ts, packages/earthwork/src/grading.ts |
dem_original |
Report header & CSV # Terrain: / # Cell size: line |
Refused: no quantities, no map snapshot, no CSV data rows, refusal reason in place |
| Pond / dam (list, card, stage-storage) | packages/earthwork/src/pond.ts, uncertainty.ts, surface-earthwork-panel.tsx |
dem_original |
Earthwork card header basis line | Refused if basin < 9 cells, basin min width < 3 cells, or dam crest < 3 cells (checkPondDamResolution) |
| Contour levees (list, card, map, 3D) | packages/earthwork/src/pond.ts, uncertainty.ts, surface-earthwork-panel.tsx |
dem_original |
Earthwork card header basis line | Refused if area < 9 cells, area min width < 3 cells, or levee base < 3 cells (checkContourLeveeResolution) |
| Surface feature GIS exports (GeoJSON, KML, DXF, Shapefile) | packages/earthwork/src/export.ts, surface-earthwork-panel.tsx |
Saved feature geometry + provenance |
GeoJSON cell_size_m, KML/DXF provenance line, Shapefile DBF CELL_M & README Cell size: |
Refused contour levees emit no computed levee lines |
| Landscape position zones (TPI) & downloads | packages/surface/src/lidar.ts, lidar-analysis-panel.tsx |
dem_original |
Shared basis footer on Lidar card; GeoJSON metadata.cell_size_m/cell_size; Shapefile README Cell size: |
Does not apply (whole-terrain neighborhood classification) |
| Topographic Wetness Index (TWI) | packages/surface/src/lidar.ts, lidar-analysis-panel.tsx |
dem_original, flow_dir |
Shared basis footer on Lidar card | Does not apply (whole-terrain raster index) |
| Elevation change (two-flight comparison) | packages/surface/src/lidar.ts, lidar-analysis-panel.tsx |
dem_original + earlier flight dem_original |
Shared basis footer on Lidar card + earlier flight cell size in Details | Does not apply (whole-terrain raster difference) |
| Change in an area (volume) | packages/surface/src/lidar.ts, lidar-analysis-panel.tsx |
ElevationChangeResult on dem_original grid |
Basis line inside change-volume box & Lidar card footer | Refused in measureChangeVolume if < 9 cells or min width < 3 cells (checkChangeAreaResolution) |
| Heights above ground, point height & dual profile | packages/surface/src/lidar.ts, lidar-analysis-panel.tsx |
dem_original + first-return surface |
Shared basis footer on Lidar card | Does not apply (whole-terrain height difference / point & line samples) |
| Printed map sheet | share-print-panel.tsx |
Visible map layers + terrainProvenance |
Included in the sheet's Sources metadata cell whenever terrain layers are visible |
Does not apply (map print layout) |
Where the rule is enforced
Each engine refuses for itself, so an export, a job or a later panel that calls it gets the refusal and not a number. measureVolume, measureChangeVolume, delineateWatershed and summarizeLowSpots in @tilemapper/surface, like the earthwork engines and compareRainPondingOnGrid, take an optional recordedCellSizeM (the terrain's recorded cell size; omitted means the grid's own, null means the record has none and nothing is refused). A refused result carries withheld (the refusal) and withheldKind: "coarse_terrain", and every figure in it is null, never 0. The panels show the engine's refusal and no longer check for themselves. The one panel check left is on the terrain low-spot list built by the GIS worker, whose summary carries no refusal; the list the browser rebuilds when a culvert is in force carries the engine's.
What the two thresholds mean for each result kind
All polygon minimum widths are computed with polygonMinWidthM in packages/surface/src/resolution.ts as the exact rotation-invariant minimum breadth across the polygon's convex hull (so a diagonal 100 m by 8 m strip is measured as 8 m wide, not by its axis-aligned bounding box).
- Ditch (
checkDitchResolution): Tested on the ditch's design top width at minimum depth (bottomWidthM + 2 * sideSlopeHPerV * minDepthM), which is the excavation footprint sampled across the DEM. A typical farm ditch (6 ft bottom, 3 ft deep, 3:1 slopes) is 7.32 m wide at the top (valid on 1 m and 2 m cells; refused on 3 m and 5 m cells). Using bottom width alone would refuse standard farm ditches on 1 m USGS DEMs. - Ditch drainage area (
checkDitchDrainageResolution): Tested on the delineated watershed's cell count (< 9cells refused). - Leveling area / Cut & fill (
checkGradingPlaneResolution): Refused if the polygon contains fewer than9cells OR its minimum width across is narrower than3cells. - Pond / dam (
checkPondDamResolution): Refused if the pond basin contains fewer than9cells (e.g., a 6 m basin on 5 m cells has 1 to 4 cells and is refused), OR the pond basin's minimum width is narrower than3cells, OR the dam crest top width (topWidthM) is narrower than3cells. - Contour levees (
checkContourLeveeResolution): Refused if the drawn levee area contains fewer than9cells OR its minimum width is narrower than3cells, OR each levee's embankment base footprint (topWidthM + 2 * sideSlopeHPerV * heightM) is narrower than3cells. Base footprint width is used rather than top width because a standard farm levee (3 ft top, 1.5 ft tall, 3:1 slopes) has a 3.66 m base (valid on 1 m cells, refused on 2 m to 5 m cells), whereas its 0.91 m top would be refused even on a 1 m DEM. - Watershed (
checkWatershedResolution): Refused if the delineated watershed has fewer than9cells. Land that drains in from past the terrain's edge (the outside-entry grid) counts toward the nine at the terrain's cell area, so a point just inside the edge where a stream comes onto the terrain is not refused: its watershed is large, and finer terrain would not change the answer. A watershed is outlined from a clicked point, and a point on a ridge drains only a cell or two on any terrain, so the refusal also says that a point on a ridge or high ground drains almost no land and to click lower, in a draw or channel, before the usual remedy. - Terrain low spots, the worker's list and the one rebuilt in the browser (
find_low_spots,summarizeLowSpots): A listed spot of fewer than9cells has its depth, area, volume and drainage withheld and is not shaded. Since round 7 of plan v4 (2026-12-02, finding B1) its area and volume are left out of the list's two totals too, as a spot that runs into ground with no data is, and a line beneath says how many: "1 low spot is too small to measure on 5 m cells. It isn't in these figures." Until then they stayed in, to match the worker's summary, so the headline gave a capacity its only row refused. The worker leaves them out of its totals and storesrefused_count, on cells coarse enough to refuse a listed spot (100 m² / c² < 9, cells over about 3.3 m); on finer cells no listed spot can be refused and the summary is stored as before. An older worker summary has norefused_countand kept them in: where every listed spot is among its rows, the app takes each refused row's figures back out (lowSpotTotalsinapps/web/src/lib/terrain/low-spot-rows.ts); where some aren't and the cells are that coarse, there may be refused spots it can't see, so it gives no total and says to rebuild the terrain. Worked by hand (resolution.test.ts,low-spot-totals.test.ts): 5 m cells, one four-cell pit 1 m deep, 100 m² and 100 m³; the row is refused and both totals are 0, where they were 100 m² and 100 m³. - Measured volume (
checkMeasuredVolumeResolution): Refused if the drawn polygon has fewer than9cells OR its minimum width is narrower than3cells. - Lidar change in an area (
checkChangeAreaResolution): Refused if the drawn polygon has fewer than9cells OR its minimum width is narrower than3cells. - Rain comparison low spots (
checkLowSpotResolution): Listed depressions (>= 100 m²and>= 0.10 mdeep) with fewer than9cells are refused. On 5 m cells (25 m²/cell), depressions of 100 to 200 m² (4 to 8 cells) meet the listing rule but fall under 9 cells.
Rain comparison: how the 100 m² listing rule meets the 9-cell refusal rule
In compareRainPondingOnGrid (packages/surface/src/runoff.ts):
- Routing and water balance are never disrupted: Every depression in
fill_depth(listed spots of any cell count, and smaller unlisted spots) still receives its local runoff and upstream spills and passes overflow downstream in topological order. A refused listed low spot's stored volume still counts inheldInListedSpotsM3, so the six-term water balance (rainIn = heldInListed + heldInSmaller + runOffTerrain + removedByTile + notRunOff) still closes to within0.001 m³. - Depth, area, shading, and headline totals are withheld for refused spots: Any listed low spot with fewer than
9cells is flagged withrefusedcontaining"too small to measure", hasdepthM = null,areaM2 = null,acres = null, andstageM = null, writes0intopondedDepthM(no map shading), and is left out oftotalListedVolumeM3,totalAcreFeet,totalPondedAcres, andmaxPondedDepthMso the totals equal the sum of rows that show a figure, matchingsummarizeLowSpots. A spot that is both cut off by missing ground and too coarse (< 9cells) is counted once, incutOffListedSpotCount, and not also inrefusedListedSpotCount. - The UI states the count and shows the refusal in place of depth and area: The rain comparison panel and side-by-side swipe card display how many listed low spots are too small to measure and state that they are left out of those figures while their water still counts in the balance (
refusedLowSpotsNoteinapps/web/src/app/projects/[projectId]/water-answers.ts); each refused row in the low-spot table displays"Needs finer terrain"with its cell count and cell size in place of its depth and area. - Worked by hand (
packages/surface/src/runoff.test.ts): A 16 × 10 grid on 5 m cells (25 m²/cell), all draining south under 4 in of rain (0.1016 m, all-rain mode), with three flat-bottomed basins0.5 mdeep: Spot A (3 × 3 = 9 cells,225 m², draining15cells =375 m², holding38.1 m³, measured), Spot B (2 × 2 = 4 cells,100 m², draining8cells =200 m², holding20.32 m³, too coarse only), and Spot C (2 × 2 = 4 cells,100 m², draining8cells =200 m², holding20.32 m³, beside a missing-ground gap at rows 2..3, col 13, so both cut off and too coarse). The engine returnscutOffListedSpotCount = 1,refusedListedSpotCount = 1,totalListedVolumeM3 = 38.1 m³(0.030888 ac-ft, equal to Spot A alone),totalPondedAcres = 0.0556 ac(225 m²),maxPondedDepthM = 38.1 / 225 = 0.16933 m, and a closing balance (rainInM3 = 401.32 m³,heldInListedSpotsM3 = 78.74 m³,runOffTerrainM3 = 322.58 m³).
Results the refusal rule does not apply to, and why
- Water level over ground (
floodAtElevation): Evaluates every cell across the entire terrain grid at a uniform stage, not an isolated small feature or basin. - Raindrop path (
traceRaindrop): Traces a one-cell-wide D8 descent path from a single clicked point; it has no cross-section width or basin cell count to threshold. - Culvert capacity (
computeCulvertCapacity) and flow breach (applyCulvertToFlowGrid): Hydraulic capacity is computed purely from FHWA HDS-5 equations and entered pipe dimensions/elevations, reading no terrain grid at all. Flow breaching is a one-cell topological connection across a road or berm rather than a DEM-sampled cross-section (a 24-inch pipe is always narrower than 3 cells even on a 1 m DEM). - Spot elevations and Elevation profile: Point and 1D line samples of the DEM surface with no feature width or basin area.
- Full-terrain Lidar overlays (Landscape position / TPI, Topographic Wetness Index / TWI, full-terrain Elevation change, Heights above ground): Raster-wide analyses over the full terrain grid. Only the drawn change in an area polygon is checked against the 3-cell / 9-cell thresholds.
- DEM GeoTIFF, Contour exports, and Printed map sheet: Whole-surface data exports and layout prints; they record and show the terrain cell size rather than being refused.