@mailwoman/soil 9.4.0 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +118 -116
  2. package/lib/index.ts +66 -98
  3. package/lib/paths.ts +24 -0
  4. package/lib/schema.ts +188 -120
  5. package/lib/vocabulary.ts +40 -107
  6. package/out/index.d.ts +52 -70
  7. package/out/index.d.ts.map +1 -1
  8. package/out/index.js +24 -72
  9. package/out/index.js.map +1 -1
  10. package/out/paths.d.ts +19 -0
  11. package/out/paths.d.ts.map +1 -0
  12. package/out/paths.js +21 -0
  13. package/out/paths.js.map +1 -0
  14. package/out/schema.d.ts +187 -119
  15. package/out/schema.d.ts.map +1 -1
  16. package/out/schema.js +31 -31
  17. package/out/schema.js.map +1 -1
  18. package/out/sdk/acquire.d.ts +15 -24
  19. package/out/sdk/acquire.d.ts.map +1 -1
  20. package/out/sdk/acquire.js +5 -20
  21. package/out/sdk/acquire.js.map +1 -1
  22. package/out/sdk/build-soil.d.ts +67 -70
  23. package/out/sdk/build-soil.d.ts.map +1 -1
  24. package/out/sdk/build-soil.js +65 -95
  25. package/out/sdk/build-soil.js.map +1 -1
  26. package/out/sdk/cell-tiers.d.ts +7 -19
  27. package/out/sdk/cell-tiers.d.ts.map +1 -1
  28. package/out/sdk/cell-tiers.js +19 -38
  29. package/out/sdk/cell-tiers.js.map +1 -1
  30. package/out/sdk/cells.d.ts +15 -41
  31. package/out/sdk/cells.d.ts.map +1 -1
  32. package/out/sdk/cells.js +11 -38
  33. package/out/sdk/cells.js.map +1 -1
  34. package/out/sdk/client.d.ts +23 -48
  35. package/out/sdk/client.d.ts.map +1 -1
  36. package/out/sdk/client.js +19 -63
  37. package/out/sdk/client.js.map +1 -1
  38. package/out/sdk/download.d.ts +24 -47
  39. package/out/sdk/download.d.ts.map +1 -1
  40. package/out/sdk/download.js +14 -54
  41. package/out/sdk/download.js.map +1 -1
  42. package/out/sdk/ingest/chunk.d.ts +77 -0
  43. package/out/sdk/ingest/chunk.d.ts.map +1 -0
  44. package/out/sdk/{ingest-chunk.js → ingest/chunk.js} +19 -17
  45. package/out/sdk/ingest/chunk.js.map +1 -0
  46. package/out/sdk/ingest/worker.d.ts +9 -0
  47. package/out/sdk/ingest/worker.d.ts.map +1 -0
  48. package/out/{scripts/ingest-chunk.js → sdk/ingest/worker.js} +11 -10
  49. package/out/sdk/ingest/worker.js.map +1 -0
  50. package/out/sdk/ingest.d.ts +40 -52
  51. package/out/sdk/ingest.d.ts.map +1 -1
  52. package/out/sdk/ingest.js +18 -61
  53. package/out/sdk/ingest.js.map +1 -1
  54. package/out/sdk/measure-resolutions.d.ts +5 -16
  55. package/out/sdk/measure-resolutions.d.ts.map +1 -1
  56. package/out/sdk/measure-resolutions.js +3 -15
  57. package/out/sdk/measure-resolutions.js.map +1 -1
  58. package/out/sdk/reduce.d.ts +33 -59
  59. package/out/sdk/reduce.d.ts.map +1 -1
  60. package/out/sdk/reduce.js +47 -78
  61. package/out/sdk/reduce.js.map +1 -1
  62. package/out/sdk/survey-area.d.ts +16 -48
  63. package/out/sdk/survey-area.d.ts.map +1 -1
  64. package/out/sdk/survey-area.js +33 -77
  65. package/out/sdk/survey-area.js.map +1 -1
  66. package/out/sdk/tabular.d.ts +32 -31
  67. package/out/sdk/tabular.d.ts.map +1 -1
  68. package/out/sdk/tabular.js +58 -56
  69. package/out/sdk/tabular.js.map +1 -1
  70. package/out/sdk/test-kit.d.ts +57 -0
  71. package/out/sdk/test-kit.d.ts.map +1 -0
  72. package/out/{test-kit.js → sdk/test-kit.js} +18 -39
  73. package/out/sdk/test-kit.js.map +1 -0
  74. package/out/sdk/verify.d.ts +15 -51
  75. package/out/sdk/verify.d.ts.map +1 -1
  76. package/out/sdk/verify.js +19 -77
  77. package/out/sdk/verify.js.map +1 -1
  78. package/out/vocabulary.d.ts +37 -103
  79. package/out/vocabulary.d.ts.map +1 -1
  80. package/out/vocabulary.js +34 -107
  81. package/out/vocabulary.js.map +1 -1
  82. package/package.json +36 -190
  83. package/{lib/sdk → sdk}/acquire.ts +17 -27
  84. package/{lib/sdk → sdk}/build-soil.ts +114 -128
  85. package/{lib/sdk → sdk}/cell-tiers.ts +20 -39
  86. package/{lib/sdk → sdk}/cells.ts +17 -43
  87. package/sdk/client.ts +147 -0
  88. package/sdk/download.ts +131 -0
  89. package/{lib/sdk/ingest-chunk.ts → sdk/ingest/chunk.ts} +34 -26
  90. package/{lib/scripts/ingest-chunk.ts → sdk/ingest/worker.ts} +10 -9
  91. package/sdk/ingest.ts +253 -0
  92. package/{lib/sdk → sdk}/measure-resolutions.ts +5 -16
  93. package/sdk/reduce.ts +344 -0
  94. package/{lib/sdk → sdk}/survey-area.ts +39 -83
  95. package/{lib/sdk → sdk}/tabular.ts +62 -59
  96. package/{lib → sdk}/test-kit.ts +18 -40
  97. package/{lib/sdk → sdk}/verify.ts +29 -85
  98. package/lib/sdk/client.ts +0 -184
  99. package/lib/sdk/download.ts +0 -161
  100. package/lib/sdk/index.ts +0 -20
  101. package/lib/sdk/ingest.ts +0 -278
  102. package/lib/sdk/reduce.ts +0 -375
  103. package/out/scripts/ingest-chunk.d.ts +0 -11
  104. package/out/scripts/ingest-chunk.d.ts.map +0 -1
  105. package/out/scripts/ingest-chunk.js.map +0 -1
  106. package/out/sdk/index.d.ts +0 -20
  107. package/out/sdk/index.d.ts.map +0 -1
  108. package/out/sdk/index.js +0 -20
  109. package/out/sdk/index.js.map +0 -1
  110. package/out/sdk/ingest-chunk.d.ts +0 -73
  111. package/out/sdk/ingest-chunk.d.ts.map +0 -1
  112. package/out/sdk/ingest-chunk.js.map +0 -1
  113. package/out/test-kit.d.ts +0 -79
  114. package/out/test-kit.d.ts.map +0 -1
  115. package/out/test-kit.js.map +0 -1
@@ -3,77 +3,57 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Build `soil.db` — the sealed polygon layer, from the survey areas NRCS publishes.
6
+ * Builds the sealed `soil.db` polygon layer from NRCS soil survey areas.
7
7
  *
8
- * THE ACCUMULATION IS IN SQL, NOT IN A MAP. Classification is per delineation and shared with the
9
- * resolution measurement, but where the touches GO differs on purpose: the measuring instrument holds
10
- * them in memory because it is comparing candidate resolutions in one pass, and the builder streams them
11
- * into a temporary table because memory has to stay flat in row count. A polygon layer's touches
12
- * outnumber its features, and Iowa is 99 survey areas.
13
- *
14
- * ABSENCE IS NO ROW, IN EVERY TABLE. Land outside a published survey area gets no `layer_coverage` row and
15
- * no summary row — never a zero, never an empty histogram. Inside a published area the coverage row says
16
- * `designated` at completeness 1.0, because NRCS declares its own mapping complete for those areas at its
17
- * own scale; a coverage cell reached ONLY by `NOTCOM` and access-denied polygons gets no row either,
18
- * because the polygon exists and the soil mapping behind it does not.
19
- *
20
- * A COVERAGE ROW LICENSES ONLY THAT THE AUTHORITY MAPPED HERE. The reading is the class distribution, and
21
- * a cell that is 100% `unrated_share` is `designated`-complete and carries no capability reading
22
- * whatsoever. That pairing is not a corner case: 17.1% of national components carry no capability rating,
23
- * and for the irrigated rating the figure is 85.1%.
24
- *
25
- * THE AREA CROSS-CHECK USES THE AUTHORITY'S OWN PUBLISHED FIGURE. `legend.areaacres` is what NRCS states
26
- * the survey area covers — 378,800 acres for `IA153`, which is 1,532.9 km² against the 1,532.5 km² an
27
- * independent projected measurement of the same shapefile reports. Comparing the spherical ring sum
28
- * against it catches a hole read as an exterior ring, whose absence is silent: such a polygon is
29
- * well-formed and simply answers "inside" for ground the authority did not map.
8
+ * The builder streams cell touches into a temporary SQL table so that memory stays flat as the row
9
+ * count grows. Absent data has no row in any table. Land outside a survey area and coverage cells that
10
+ * only `notcom` or access-denied polygons reach, get no coverage row.
30
11
  */
31
12
  import { readFileSize } from "@mailwoman/core/fs/readers";
32
13
  import { areaAgreementFrom, createLayerCoverageTable, createLayerManifestTable, designatedCoverageCells, polygonLayerManifest, writeLayerCoverage, writeLayerManifest, } from "@mailwoman/core/layers";
33
14
  import { resolveModulePath } from "@mailwoman/core/module/resolvers";
34
15
  import { ingestChunkArguments, mergeCountsInto, runChunkProcess } from "@mailwoman/core/utils";
35
16
  import { arealPolygons, geometryContains, interiorCoverageCells, shortCellToInt, } from "@mailwoman/spatial";
36
- import { buildSealedArtifact } from "@mailwoman/sqlite/sealed-build";
17
+ import { buildSealedArtifact } from "@mailwoman/sqlite/sealed/build";
37
18
  import { cellToLatLng } from "h3-js";
38
19
  import { createSoilTables } from "#schema";
39
20
  import { reduceCells, resolveCells } from "#sdk/cell-tiers";
40
- import { ingestSoilChunk } from "#sdk/ingest-chunk";
21
+ import { ingestSoilChunk } from "#sdk/ingest/chunk";
41
22
  import { WEIGHT_LATTICE_DEPTH } from "#sdk/reduce";
42
23
  import { SOIL_SHARE_WEIGHTING, SOIL_SHARE_WEIGHTING_DESCRIPTION, soilLayerName, SSURGO_ATTRIBUTION, SSURGO_LICENSE, SSURGO_SOURCE, } from "#vocabulary";
43
24
  /**
44
- * Schema version of the domain tables. Bumped when a column changes meaning, never for an added column a reader can
45
- * ignore.
25
+ * The schema version of the domain tables.
26
+ *
27
+ * It changes when a column changes meaning.
28
+ * An added column that readers can ignore does not change it.
46
29
  */
47
30
  export const SOIL_SCHEMA_VERSION = 1;
48
31
  /**
49
- * Delineation ids per chunk process.
32
+ * The number of delineation ids per chunk process.
50
33
  *
51
- * Sized against the ceiling the flood layer measured rather than guessed: single-process runs over that product died
52
- * after roughly 510,000 and 798,000 features as h3's WASM heap fragmented. 100,000 leaves five times that margin, and
53
- * the cost of a smaller number is one interpreter start per chunk. Iowa's largest survey area holds well under it, so
54
- * on this build the bound costs one process per area — which is what makes an area's failure nameable.
34
+ * A single process over a large polygon layer fails after several hundred thousand
35
+ * features because the h3 wasm heap fragments.
36
+ * This size stays well below that limit.
55
37
  */
56
38
  export const DEFAULT_CHUNK_SIZE = 100_000;
57
39
  /**
58
- * Square metres in an acre — the unit `legend.areaacres` publishes in.
40
+ * Square meters per acre, the unit of `legend.areaacres`.
59
41
  */
60
42
  const M2_PER_ACRE = 4046.8564224;
61
43
  /**
62
- * The relative gap between the ring-area total and the authority's own published acreage that fails the build.
44
+ * The relative gap between the ring-area total and the published acreage above which the build fails.
63
45
  *
64
- * Two percent. The comparison is a spherical ring area against a figure NRCS itself warns "may differ from that
65
- * measured using GIS software due to different measuring techniques and rounding practices, or due to the fact that the
66
- * value has been adjusted so that the sum total of all map units in the legend equals that listed for soil survey area"
67
- * — so an exact test would be brittle. Two percent sits far above the 0.03% `IA153` measures and far below the error a
68
- * hole-blind read produces, which the zoning survey measured at 4.1% over a whole national layer.
46
+ * NRCS warns that its acreage can differ from a GIS measurement, so an exact
47
+ * comparison would fail on valid data.
48
+ * A hole read as an exterior ring produces a much larger gap than this tolerance.
69
49
  */
70
50
  const AREA_TOLERANCE = 0.02;
71
51
  /**
72
- * Build the layer.
52
+ * Builds the soil layer.
73
53
  *
74
- * @throws {Error} On a delineation the classifier refuses, a streamed count that disagrees with the shapefile's own
75
- * declaration, an area total that disagrees with the authority's published acreage, or a set of outlines that yields
76
- * no interior coverage cell at all.
54
+ * @throws {Error} When the classifier rejects a delineation, when a streamed count
55
+ * differs from the shapefile's declared count, when the area total differs from the
56
+ * published acreage, or when the outlines contain no interior coverage cell.
77
57
  */
78
58
  export async function buildSoilDatabase(options) {
79
59
  if (options.coverageResolution >= options.indexResolution) {
@@ -88,15 +68,14 @@ export async function buildSoilDatabase(options) {
88
68
  await createSoilTables(kdb);
89
69
  await createLayerManifestTable(kdb);
90
70
  await createLayerCoverageTable(kdb);
91
- // The touch table exists only for this build and is dropped before the artifact is sealed. No primary key while
92
- // loading: the resolution queries below read it through indexes created once the load is done, and a clustered
93
- // key would sort every insert against an ingest order nothing controls.
71
+ // The touch table is dropped before the artifact is sealed.
72
+ // It has no primary key because a clustered key would sort every insert.
73
+ // The resolution queries use indexes that are created after the load.
94
74
  kdb.exec("CREATE TABLE build_cell_touch (h3_cell INTEGER NOT NULL, resolution INTEGER NOT NULL, area_id TEXT NOT NULL, is_full INTEGER NOT NULL)");
95
75
  },
96
76
  ingest: async (kdb) => {
97
- // Attributes FIRST because the ingest needs one thing out of them — which map units have no soil mapping behind
98
- // them — and because a delineation whose map unit is missing must fail while the artifact is still empty rather
99
- // than after millions of geometry rows are written.
77
+ // The attributes are written first because the ingest needs the map units that have no soil mapping.
78
+ // The build writes them first so a delineation with a missing map unit fails early.
100
79
  writeAttributes(kdb, options.areas);
101
80
  if (!options.inProcess)
102
81
  return undefined;
@@ -116,10 +95,10 @@ export async function buildSoilDatabase(options) {
116
95
  await writeLayerCoverage(kdb, coverage.cells);
117
96
  writeSurveyAreaRows(kdb, options, coverage.cellsByArea);
118
97
  writeVocabularyRows(kdb, options.areas);
119
- // THE SPINE KEY NAMES THE TABLE A CONSUMER JOINS ON, table-qualified, per the layer contract. For this layer
120
- // that is the REDUCTION rather than the containment index: `soil_capability_cell` holds one row per cell at one
121
- // resolution, which `soil_map_unit_cell` does not — it is keyed `(cell, delineation)` and is mixed-resolution by
122
- // construction, so it is a tier the reader walks rather than a key a consumer joins.
98
+ // The spine key is the column that consumers join on.
99
+ // It points at `soil_capability_cell`, which has one row per cell at one resolution.
100
+ // The `soil_map_unit_cell` table is keyed by cell and delineation at mixed
101
+ // resolutions, so consumers cannot join on it.
123
102
  await writeLayerManifest(kdb, polygonLayerManifest(options, {
124
103
  name: soilLayerName(options.region),
125
104
  schemaVersion: SOIL_SCHEMA_VERSION,
@@ -131,7 +110,7 @@ export async function buildSoilDatabase(options) {
131
110
  kdb.exec("DROP TABLE build_cell_touch");
132
111
  const totalCellRows = cells.wholeRows + cells.partialRows;
133
112
  return {
134
- out: options.out,
113
+ out: options.out.toString(),
135
114
  region: options.region,
136
115
  surveyAreas: options.areas.length,
137
116
  delineations: ingested.delineations,
@@ -160,10 +139,9 @@ export async function buildSoilDatabase(options) {
160
139
  return { ...built, sizeBytes: await readFileSize(options.out) };
161
140
  }
162
141
  /**
163
- * Add up what the chunks reported.
142
+ * Sums the results of the ingest chunks.
164
143
  *
165
- * Exported for its own test: the coverage-cell arithmetic is the one part of the batched path a fixture build cannot
166
- * reach, and getting it wrong produces a well-formed artifact that under-reports how many delineations a cell holds.
144
+ * It is exported for a unit test because fixture builds do not exercise the batched path.
167
145
  */
168
146
  export function aggregateChunks(chunks) {
169
147
  const byArea = new Map();
@@ -179,17 +157,14 @@ export function aggregateChunks(chunks) {
179
157
  nestedM2 += chunk.area.nestedM2;
180
158
  allExteriorM2 += chunk.area.allExteriorM2;
181
159
  byArea.set(chunk.areaSymbol, (byArea.get(chunk.areaSymbol) ?? 0) + chunk.delineations);
182
- // A coverage cell straddles chunk boundaries — a range of feature ids is not a region, and a coverage cell can
183
- // straddle two survey areas — so the counts ADD rather than replace.
160
+ // One coverage cell can appear in several chunks and in two survey areas, so the counts are summed.
184
161
  mergeCountsInto(observedByCoverageCell, chunk.observedByCoverageCell);
185
162
  mergeCountsInto(mappedByCoverageCell, chunk.mappedByCoverageCell);
186
163
  }
187
164
  return { delineations, coarsened, byArea, observedByCoverageCell, mappedByCoverageCell, nestedM2, allExteriorM2 };
188
165
  }
189
166
  /**
190
- * Refuse a build that streamed fewer delineations than a survey area declares.
191
- *
192
- * A short read builds a smaller county and reports success, which is the partial result that must throw.
167
+ * Throws when the streamed delineation count of a survey area differs from its declared count.
193
168
  */
194
169
  function assertDelineationCounts(areas, streamed) {
195
170
  for (const area of areas) {
@@ -203,11 +178,11 @@ function assertDelineationCounts(areas, streamed) {
203
178
  }
204
179
  }
205
180
  /**
206
- * Refuse an artifact whose rings do not add up to the acreage the authority publishes.
181
+ * Throws when the ring-area total differs from the published acreage by more than {@link AREA_TOLERANCE}.
207
182
  *
208
- * The message carries the hole-blind total beside the nested one, because the gap between them is the diagnosis: a hole
209
- * read as an exterior ring answers "inside" for every point in it. A build over survey areas that publish no acreage
210
- * has no witness — the reading's own type says so, and the `known` count is what a receipt names.
183
+ * The error message includes the total with holes ignored, because a hole read
184
+ * as an exterior ring causes the gap.
185
+ * When no survey area publishes an acreage, the check is skipped.
211
186
  */
212
187
  function assertAreaAgreement(areas, streamed) {
213
188
  let publishedAcres = 0;
@@ -227,7 +202,7 @@ function assertAreaAgreement(areas, streamed) {
227
202
  return area;
228
203
  }
229
204
  /**
230
- * Write every survey area's map units, components and vocabulary before any geometry is streamed.
205
+ * Writes every survey area's map units and components.
231
206
  */
232
207
  function writeAttributes(database, areas) {
233
208
  const insertMapUnit = database.prepare("INSERT OR REPLACE INTO soil_map_unit (mukey, areasymbol, musym, muname, mukind, mustatus, farmlndcl, farmland_scope, niccdcd, niccdcdpct, no_mapping) " +
@@ -246,7 +221,7 @@ function writeAttributes(database, areas) {
246
221
  database.exec("COMMIT");
247
222
  }
248
223
  /**
249
- * The map units with no soil mapping behind them, from what was just written.
224
+ * Returns the keys of the map units that have no soil mapping.
250
225
  */
251
226
  function noMappingMukeys(areas) {
252
227
  const mukeys = new Set();
@@ -260,7 +235,8 @@ function noMappingMukeys(areas) {
260
235
  return mukeys;
261
236
  }
262
237
  /**
263
- * The in-process ingest — one chunk per survey area, all in this interpreter. Fixtures only.
238
+ * Ingests one chunk per survey area in this process.
239
+ * Only fixtures use it.
264
240
  */
265
241
  async function ingestInProcess(database, options) {
266
242
  const noMapping = noMappingMukeys(options.areas);
@@ -280,13 +256,13 @@ async function ingestInProcess(database, options) {
280
256
  return chunks;
281
257
  }
282
258
  /**
283
- * Run the ingest as a sequence of bounded child processes, one per range of one survey area's FIDs. The shared chunk
284
- * contract — the parent's no-handle rule, and the fail-loud handling of a chunk that dies or prints nothing — lives
285
- * with `ingestChunkArguments` and `runChunkProcess`.
259
+ * Runs the ingest as a sequence of child processes, one per FID range of one survey area.
260
+ *
261
+ * The shared chunk protocol and its error handling live in `ingestChunkArguments` and `runChunkProcess`.
286
262
  */
287
263
  async function runBatchedIngest(tmpPath, options) {
288
264
  const chunkSize = options.chunkSize ?? DEFAULT_CHUNK_SIZE;
289
- const script = resolveModulePath("@mailwoman/soil/scripts/ingest-chunk");
265
+ const script = resolveModulePath("@mailwoman/soil/sdk/ingest/worker");
290
266
  const noMapping = [...noMappingMukeys(options.areas)];
291
267
  const chunks = [];
292
268
  for (const area of options.areas) {
@@ -324,22 +300,16 @@ async function runBatchedIngest(tmpPath, options) {
324
300
  return chunks;
325
301
  }
326
302
  /**
327
- * The coverage rows: one per interior cell of the built footprint that soil mapping actually reaches, and none outside.
303
+ * Returns one coverage row per interior cell of the built footprint that soil mapping reaches.
328
304
  *
329
- * THE INTERIOR TEST RUNS ONCE OVER THE UNION OF EVERY OUTLINE BUILT, NOT PER SURVEY AREA, and the difference is most of
330
- * a state. The test is conservative — it keeps only cells lying WHOLLY inside — so applied per area it drops every cell
331
- * a county border crosses. Measured on Polk County alone at resolution 6: 20 interior cells against the roughly 42 the
332
- * county spans by area, so more than half of it would read `unknown` while sitting inside a survey the build had
333
- * ingested. Run over the union, only the OUTER border of the built set is dropped, which is the honest edge: beyond it
334
- * lies ground this artifact does not hold.
305
+ * The interior test keeps only cells that lie wholly inside the footprint.
306
+ * It runs once over the union of all outlines, because running it per survey area
307
+ * would drop every cell that crosses an internal county border.
335
308
  *
336
- * The conservatism itself stays. A cell wrongly called interior would state that an authority determined a location it
337
- * never looked at, and a point in the dropped strip reading `unknown` is the truthful answer for ground the built set
338
- * may or may not reach.
309
+ * Only cells on the outer border of the built set are dropped.
339
310
  *
340
- * `observed_rows` counts the delineations reaching the cell, which is what the contract's column means. A cell reached
341
- * only by `NOTCOM` and access-denied polygons gets NO ROW — the polygon exists, the soil mapping behind it does not,
342
- * and the survey's §3.2 puts that case with the absences rather than with the coverage.
311
+ * The `observed_rows` column counts the delineations that reach the cell.
312
+ * A cell that only `notcom` and access-denied polygons reach gets no row, because it has no soil mapping.
343
313
  */
344
314
  function buildCoverageCells(options, streamed) {
345
315
  const footprint = {
@@ -359,8 +329,8 @@ function buildCoverageCells(options, streamed) {
359
329
  withoutMapping++;
360
330
  continue;
361
331
  }
362
- // Attributed by the cell's CENTRE, so each row is counted for exactly one survey area even where the cell straddles
363
- // two. The count is a per-area receipt, not part of the coverage claim — the claim is the row set itself.
332
+ // The cell's center decides its survey area, so each cell counts for one area only.
333
+ // This per-area count is informational and does not affect the coverage rows.
364
334
  const [latitude, longitude] = cellToLatLng(cell);
365
335
  const owner = options.areas.find((input) => geometryContains(input.outline, longitude, latitude));
366
336
  if (owner) {
@@ -371,10 +341,10 @@ function buildCoverageCells(options, streamed) {
371
341
  return { cells, cellsByArea, withoutMapping };
372
342
  }
373
343
  /**
374
- * One outline's polygons, in the `MultiPolygon` coordinate shape, whichever areal type it arrived as.
344
+ * Returns an outline's polygons in `MultiPolygon` coordinate form.
375
345
  *
376
- * @throws {TypeError} When the outline is not areal. A survey area whose footprint cannot be read would silently
377
- * contribute nothing to the union, and the coverage over it would simply be absent.
346
+ * @throws {TypeError} When the outline is not a polygon or multipolygon.
347
+ * The build would silently drop that survey area's coverage if it skipped the outline.
378
348
  */
379
349
  function outlinePolygons(outline) {
380
350
  const polygons = arealPolygons(outline);
@@ -383,7 +353,7 @@ function outlinePolygons(outline) {
383
353
  throw new TypeError(`soil build: a survey-area outline is a ${outline.type}, which bounds no area — its coverage would be silently absent rather than refused`);
384
354
  }
385
355
  /**
386
- * Insert one row per survey area.
356
+ * Inserts one row per survey area.
387
357
  */
388
358
  function writeSurveyAreaRows(database, options, cellsByArea) {
389
359
  const insert = database.prepare("INSERT OR REPLACE INTO soil_survey_area (areasymbol, areaname, saverest, saversion, survey_source_date, survey_source_title, source_scale, mapping_scale, area_acres, min_lat, min_lon, max_lat, max_lon, coverage_cells, coverage_resolution) " +
@@ -415,10 +385,10 @@ function writeSurveyAreaRows(database, options, cellsByArea) {
415
385
  database.exec("COMMIT");
416
386
  }
417
387
  /**
418
- * Insert the authority's declared domains, plus the weighting the shares were produced under.
388
+ * Inserts the authority's declared domains and the share weighting.
419
389
  *
420
- * The weighting rides in the vocabulary table as well as on every row: the row-level copy is what a consumer reads, and
421
- * this one carries the sentence that says what it MEANS, which no column can.
390
+ * Every cell row stores the weighting code.
391
+ * The vocabulary row adds the description of that code.
422
392
  */
423
393
  function writeVocabularyRows(database, areas) {
424
394
  const insert = database.prepare("INSERT OR REPLACE INTO soil_vocabulary (domain, code, definition, sequence) VALUES (?, ?, ?, ?)");
@@ -1 +1 @@
1
- {"version":3,"file":"build-soil.js","sourceRoot":"","sources":["../../lib/sdk/build-soil.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EACN,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GAGlB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC9F,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,GAGd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAAE,gBAAgB,EAA+C,MAAM,SAAS,CAAA;AACvF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,EACN,oBAAoB,EACpB,gCAAgC,EAChC,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,aAAa,GACb,MAAM,aAAa,CAAA;AAEpB;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAEpC;;;;;;;G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,IAAI,CAAC,QAAQ,CAAC,CAAA;AACxB,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,QAAsC,EAAE,KAAqC;IACzG,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAC9B,iGAAiG,CACjG,CAAA;IAED,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAEtB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC9C,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC3E,CAAC;IACF,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,oBAAoB,CAAC,CAAA;IAE3G,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACxB,CAAC"}
@@ -3,26 +3,15 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The two phases between the streamed touches and the artifact a consumer reads: the stored containment
7
- * index, and the reduction above it.
8
- *
9
- * BOTH READ THE TOUCH TABLE, AND ONLY ONE OF THEM COMPACTS. `resolveCells` writes the tiers a probe walks
10
- * and collapses uniform interiors parent-ward; `reduceCells` reads the UNCOMPACTED touches, because a
11
- * compacted parent no longer names the cells the reduction has to answer.
12
- *
13
- * THE REDUCTION IS THE SLOW PHASE AND ITS MEMORY IS BOUNDED BY CONSTRUCTION. A lattice of 49 point tests
14
- * per sampled cell, over a delineation cache that is cleared whole rather than evicted one entry at a
15
- * time — see {@link GEOMETRY_CACHE_ENTRIES}. Memory stays flat in row count, which is the property the poi
16
- * build lost when a reader materialized instead of streaming.
6
+ * Turns the build's cell-touch table into the containment index and the per-cell capability reduction.
17
7
  */
18
8
  import type { DatabaseClient } from "@mailwoman/sqlite/client";
19
9
  import { type SoilDatabase } from "#schema";
20
10
  /**
21
- * Resolve the touch table into the stored containment index.
11
+ * Writes the touch table into the `soil_map_unit_cell` containment index.
22
12
  *
23
- * Compaction happens HERE and only on the whole side. It is expected to yield close to nothing on this layer, which is
24
- * the inversion the survey predicts: compaction needs a uniform interior, and 85.4% of `IA153`'s delineations are
25
- * smaller than one resolution-9 cell.
13
+ * Only whole cells are compacted.
14
+ * Most soil delineations are smaller than one index cell, so compaction removes few rows on this layer.
26
15
  */
27
16
  export declare function resolveCells(database: DatabaseClient<SoilDatabase>, indexResolution: number): {
28
17
  wholeRows: number;
@@ -30,11 +19,10 @@ export declare function resolveCells(database: DatabaseClient<SoilDatabase>, ind
30
19
  resolutions: number[];
31
20
  };
32
21
  /**
33
- * Reduce the touch table into `soil_capability_cell`.
22
+ * Reduces the touch table into `soil_capability_cell`.
34
23
  *
35
- * Reads the touch table rather than `soil_map_unit_cell` on purpose: the stored index is compacted on the whole side,
36
- * so a compacted parent no longer names the cells the reduction has to answer. The touch table is the uncompacted truth
37
- * about which delineation reaches which cell.
24
+ * It reads the touch table because `soil_map_unit_cell` is compacted.
25
+ * A compacted parent cell hides the index cells that the reduction must answer.
38
26
  */
39
27
  export declare function reduceCells(database: DatabaseClient<SoilDatabase>, indexResolution: number, onProgress?: (message: string) => void): {
40
28
  cells: number;
@@ -1 +1 @@
1
- {"version":3,"file":"cell-tiers.d.ts","sourceRoot":"","sources":["../../lib/sdk/cell-tiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAG9D,OAAO,EAAqD,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAG9F;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,cAAc,CAAC,YAAY,CAAC,EACtC,eAAe,EAAE,MAAM,GACrB;IAAE,SAA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AAc,EAAE,MAAM,CAAA;CACtB,CAmHA"}
@@ -3,17 +3,7 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The two phases between the streamed touches and the artifact a consumer reads: the stored containment
7
- * index, and the reduction above it.
8
- *
9
- * BOTH READ THE TOUCH TABLE, AND ONLY ONE OF THEM COMPACTS. `resolveCells` writes the tiers a probe walks
10
- * and collapses uniform interiors parent-ward; `reduceCells` reads the UNCOMPACTED touches, because a
11
- * compacted parent no longer names the cells the reduction has to answer.
12
- *
13
- * THE REDUCTION IS THE SLOW PHASE AND ITS MEMORY IS BOUNDED BY CONSTRUCTION. A lattice of 49 point tests
14
- * per sampled cell, over a delineation cache that is cleared whole rather than evicted one entry at a
15
- * time — see {@link GEOMETRY_CACHE_ENTRIES}. Memory stays flat in row count, which is the property the poi
16
- * build lost when a reader materialized instead of streaming.
6
+ * Turns the build's cell-touch table into the containment index and the per-cell capability reduction.
17
7
  */
18
8
  import { expandShortCellInt, shortCellToInt } from "@mailwoman/spatial";
19
9
  import { beginBatched } from "@mailwoman/sqlite/batched";
@@ -21,11 +11,10 @@ import { compactCells, getResolution } from "h3-js";
21
11
  import { SoilCellContainment } from "#schema";
22
12
  import { mapUnitProfile, reduceCell } from "#sdk/reduce";
23
13
  /**
24
- * Resolve the touch table into the stored containment index.
14
+ * Writes the touch table into the `soil_map_unit_cell` containment index.
25
15
  *
26
- * Compaction happens HERE and only on the whole side. It is expected to yield close to nothing on this layer, which is
27
- * the inversion the survey predicts: compaction needs a uniform interior, and 85.4% of `IA153`'s delineations are
28
- * smaller than one resolution-9 cell.
16
+ * Only whole cells are compacted.
17
+ * Most soil delineations are smaller than one index cell, so compaction removes few rows on this layer.
29
18
  */
30
19
  export function resolveCells(database, indexResolution) {
31
20
  database.exec("CREATE INDEX build_cell_touch_area_cell ON build_cell_touch (area_id, resolution, is_full, h3_cell)");
@@ -35,9 +24,8 @@ export function resolveCells(database, indexResolution) {
35
24
  const insertCell = database.prepare("INSERT OR REPLACE INTO soil_map_unit_cell (h3_cell, resolution, area_id, containment) VALUES (?, ?, ?, ?)");
36
25
  const resolutions = new Set();
37
26
  let wholeRows = 0;
38
- // One group per (delineation, resolution): `compactCells` takes a single resolution, and an adaptively-indexed layer
39
- // has several. Pooling them throws; compacting only the target-resolution group would silently drop every coarsened
40
- // delineation's interior.
27
+ // Each group is one delineation at one resolution, because `compactCells` throws on mixed resolutions.
28
+ // Coarsened delineations are indexed at other resolutions, so every group must be compacted.
41
29
  database.exec("BEGIN");
42
30
  for (const { area_id: areaID, resolution } of groups) {
43
31
  const whole = database
@@ -51,9 +39,8 @@ export function resolveCells(database, indexResolution) {
51
39
  }
52
40
  }
53
41
  database.exec("COMMIT");
54
- // The partial rows are every touch that is not whole for its own delineation. `INSERT OR REPLACE` above already put
55
- // the whole rows in, and the primary key is `(h3_cell, area_id)`, so this insert must skip them explicitly rather
56
- // than rely on the key: a partial row replacing a whole one would demote an answered cell to a ray cast.
42
+ // The partial rows use `INSERT OR IGNORE` so that they never replace a whole row with the same key.
43
+ // A replaced whole row would force the reader to ray-cast a cell it could answer directly.
57
44
  database.exec("INSERT OR IGNORE INTO soil_map_unit_cell (h3_cell, resolution, area_id, containment) " +
58
45
  "SELECT DISTINCT t.h3_cell, t.resolution, t.area_id, 'partial' FROM build_cell_touch t WHERE t.is_full = 0");
59
46
  const partialRows = database.prepare("SELECT count(*) AS n FROM soil_map_unit_cell WHERE containment = 'partial'").get().n;
@@ -64,25 +51,20 @@ export function resolveCells(database, indexResolution) {
64
51
  return { wholeRows, partialRows, resolutions: [...resolutions].toSorted((left, right) => left - right) };
65
52
  }
66
53
  /**
67
- * Cells reduced per progress report. The reduction is the slow phase — a lattice of 49 point tests per sampled cell —
68
- * so it reports often enough that a long run is visibly alive.
54
+ * The number of cells reduced between progress reports and commits.
69
55
  */
70
56
  const REDUCE_PROGRESS_STRIDE = 50_000;
71
57
  /**
72
- * How many delineations the reduction keeps in memory at once.
58
+ * The maximum number of delineations that the reduction keeps in memory.
73
59
  *
74
- * Sized to bound the phase rather than to hold everything: the pilot region's median delineation encodes to roughly 1.4
75
- * kB, so 200,000 of them is a few hundred megabytes — comfortable, and far below the 2.5 million a whole state holds.
76
- * Memory stays flat in row count, which is the property the poi build lost when a reader materialized instead of
77
- * streaming.
60
+ * The limit keeps memory bounded when a state has millions of delineations.
78
61
  */
79
62
  const GEOMETRY_CACHE_ENTRIES = 200_000;
80
63
  /**
81
- * Reduce the touch table into `soil_capability_cell`.
64
+ * Reduces the touch table into `soil_capability_cell`.
82
65
  *
83
- * Reads the touch table rather than `soil_map_unit_cell` on purpose: the stored index is compacted on the whole side,
84
- * so a compacted parent no longer names the cells the reduction has to answer. The touch table is the uncompacted truth
85
- * about which delineation reaches which cell.
66
+ * It reads the touch table because `soil_map_unit_cell` is compacted.
67
+ * A compacted parent cell hides the index cells that the reduction must answer.
86
68
  */
87
69
  export function reduceCells(database, indexResolution, onProgress) {
88
70
  const profiles = readMapUnitProfiles(database);
@@ -101,11 +83,10 @@ export function reduceCells(database, indexResolution, onProgress) {
101
83
  let currentCell;
102
84
  let currentResolution = indexResolution;
103
85
  let candidates = [];
104
- // A delineation is named by every cell it reaches — 5.35 of them per cell at resolution 9 on the pilot region — so a
105
- // naive read fetches each ring blob once per touch. At Iowa's scale that is millions of blob reads of ground already
106
- // in memory. The cache is bounded and CLEARED WHOLE when it fills rather than evicted one at a time: h3 cell integers
107
- // carry their ancestry in their high bits, so a scan in `h3_cell` order visits neighbours together and a cleared cache
108
- // refills with the delineations the next run of cells actually names.
86
+ // Each delineation touches several cells, so the cache avoids reading its rings once per touch.
87
+ // The cache is cleared whole when it fills.
88
+ // The scan runs in `h3_cell` order and visits neighboring cells together.
89
+ // After a clear, the cache refills with the delineations that the next cells need.
109
90
  const geometry = new Map();
110
91
  const batch = beginBatched(database, { rowsPerCommit: REDUCE_PROGRESS_STRIDE });
111
92
  const flush = () => {
@@ -170,7 +151,7 @@ function insertRow(statement, row) {
170
151
  statement.run(row.h3_cell, row.class_shares, row.unrated_share, row.notrateable_share, row.nodata_share, row.other_share, row.mapped_share, row.top_class, row.top_class_share, row.weighting, row.delineations);
171
152
  }
172
153
  /**
173
- * Every map unit's per-unit-area profile, computed once and reused for every cell it reaches.
154
+ * Computes every map unit's profile once so that each cell reuses it.
174
155
  */
175
156
  function readMapUnitProfiles(database) {
176
157
  const componentsByMukey = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"cell-tiers.js","sourceRoot":"","sources":["../../lib/sdk/cell-tiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAA;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAEnD,OAAO,EAAE,mBAAmB,EAAmD,MAAM,SAAS,CAAA;AAC9F,OAAO,EAAE,cAAc,EAAE,UAAU,EAA2C,MAAM,aAAa,CAAA;AAEjG;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC3B,QAAsC,EACtC,eAAuB;IAEvB,QAAQ,CAAC,IAAI,CAAC,qGAAqG,CAAC,CAAA;IAEpH,MAAM,MAAM,GAAG,QAAQ;SACrB,OAAO,CAAC,6EAA6E,CAAC;SACtF,GAAG,EAAoD,CAAA;IAEzD,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAClC,2GAA2G,CAC3G,CAAA;IAED,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAA;IAErC,IAAI,SAAS,GAAG,CAAC,CAAA;IAEjB,qHAAqH;IACrH,oHAAoH;IACpH,0BAA0B;IAC1B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAEtB,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,MAAM,EAAE,CAAC;QACtD,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